A picture taken on March 19, 2007 shows an Egyptian border policeman standing guard not far from an Israeli watch tower at the Karm Abu Salem border gate leading to the Philadelphi corridor, a buffer zone that separates Egypt from Israel and the Gaza Strip. Several Egyptian border guards were killed on August 5, 2012 in an attack on a checkpoint near the Kerem Shalom border crossing. (Cris Bouroncle/AFP/Getty Images)

Armed militants killed at least 15 Egyptian security troops Sunday at a checkpoint near the Israeli border and commandeered armored vehicles they later used to storm into the neighboring country, security officials said. The second phase of the attack failed after the Israeli military launched an airstrike on the militants at a border crossing, authorities said.

The assault, carried out with explosives and small arms, was the starkest sign to date that extremist militant cells that have seized on rising lawlessness in Egypt’s Sinai Peninsula pose a dire threat to the uneasy coexistence between the two nations.

The specific goals of the militant groups that have taken root in the area are unclear, but community leaders say they are driven by a desire to avenge the abuses of Egyptian security forces and are sympathetic to the plight of Palestinians.

The masked gunmen attacked a security checkpoint near Rafah — the main gateway to the Gaza Strip, a Palestinian territory governed by the militant group Hamas — shortly after sunset, according to security officials and Egyptian news media reports. After ambushing police officers at a time of day when Muslims break the fast during the holy month of Ramadan, the militants stole at least two armored personnel carriers and drove toward Israel, security officials said.

At approximately 8 p.m., one of the vehicles transporting the gunmen exploded at the Kerem Shalom border crossing, according to Brig. Gen. Yoav Mordechai, an Israeli military spokesman. A second vehicle barreled across the border, the spokesman said, prompting the Israeli military to attack it from an aircraft.

At least three of the militants were killed trying to escape, Mordechai said. Israeli officials said Sunday night that there were no known Israeli casualties but urged residents who live across the border to stay indoors, fearing that some of the attackers could have made it inside.

Israeli Defense Minister Ehud Barak praised his troops for “thwarting an attack that could have caused many casualties,” and he called on the Egyptian government to restore order in the Sinai.

“The modes of operation of the attackers again raise the need for determined Egyptian action to enforce security and prevent terror in Sinai,” Barak said.

In June, two gunmen killed an Israeli construction worker who was part of a team building a fence along the border. Last August, a cross-border attack near the Red Sea resort town of Eilat left eight Israelis dead.

Egyptian President Mohamed Morsi met with the country’s top generals Sunday night to discuss how to respond. He issued a statement late Sunday saying the “cowardly attack will not pass without a response” and vowing to take action against the culprits.

Egypt’s state-run news agency reported that the Rafah crossing would be closed until further notice.

Security in the vast desert peninsula has deteriorated sharply since Egypt’s 2011 revolt, during which police stations in Sinai were torched. The ouster of leader Hosni Mubarak led to the release of hundreds of Islamists who had been imprisoned for years, in many cases without being put on trial.

Bedouin leaders and other Sinai residents say cells of extremist Islamist militants have established training camps in North Sinai in recent months and have carried out a wave of attacks against lightly armed police forces.

Fearing the kind of security crackdown that came after resort bombings in the Sinai in 2004 and 2006, Bedouin tribesmen have stockpiled weapons that have streamed in from neighboring Libya, saying they will fight back if the government attempts to carry out mass roundups.

The militant groups in the Sinai have kept a relatively low profile until recently. On Wednesday, a statement posted on Internet forums used by jihadists announced the formation of a new group called Soldiers of Islamic Law. The statement, which was translated by the SITE Intelligence Group, said the group’s fighters include men who have fought in the East and West. It listed five demands aimed at the Egyptian and U.S. governments.

They include the establishment of Islamic law throughout Egypt, starting in the Sinai; the release of prisoners; and the withdrawal of American peacekeeping troops stationed along the border as part of an international operation to enforce the U.S.-brokered 1979 peace treaty between Egypt and Israel.

Greenberg reported from Jerusalem. Ingy Hassieb and Haitham Mohamed in Cairo contributed to this report.