EL-ARISH, Egypt — Masked gunmen killed 16 Egyptian soldiers Sunday at a checkpoint along the border with Gaza and Israel, the first such attack on troops — and then the attackers drove off, crashing into Israel, officials said.
Egypt blamed Islamist militants from Gaza and Egypt's troubled Sinai Peninsula. President Mohammed Morsi said the attackers "will pay dearly."
The Israeli military said the attack was part of a plot to abduct an Israeli soldier, and two vehicles commandeered by the attackers crashed into Israel, where one blew up.
In a statement, Israel's Defense Minister Ehud Barak said Israel's military and the internal security agency "thwarted an attack that could have injured many. The militants' attack methods again raise the need for determined Egyptian action to enforce security and prevent terror in the Sinai."
The attack took place around sunset in the Egyptian border town of Rafah, when the troops were having the traditional meal at the end of the daily fast during the Islamic holy month of Ramadan.
Egyptian state TV said the attack on the checkpoint was carried out by Islamist militants. The report said 16 troops were killed in the attack coordinated between Palestinians who entered Egypt from Gaza and Egyptians in Sinai.
Emergency services official Ahmed el-Ansari told Egypt's news agency that seven were wounded by gunfire.
Egypt's President Mohammed Morsi convened an emergency meeting with military and security leaders following the attack. In a statement from the president's office, Morsi offered his condolences to the families of the dead and said the "cowardly" attack will not go "without a response."
"Those who carried out this crime will pay dearly," Morsi's statement said.
The head of the border guards, a paramilitary force under the command of Egypt's Defense Ministry, went to the scene of the attack, the TV said.
In a statement late Sunday, Morsi's Muslim Brotherhood urged Egyptian authorities to take all necessary measures to "confront this serious challenge to the Egyptian sovereignty and to protect Sinai from all armed groups."
It was one of the bloodiest attacks in Sinai in years and the deadliest against Egyptian troops, underlining the growing lawlessness of the Egyptian territory, where security forces have become targets of militants, some loosely linked with al-Qaida.
Israeli military spokeswoman Lt. Col. Avital Leibovich said one vehicle exploded, and Israeli aircraft struck the second one. Israeli government spokesman Ofir Gendelman said on his Twitter account that seven militants were killed, four on the Israeli side and three in Egypt.
Leibovich said Israeli soldiers were combing the area for other militants who might still be on the Israeli side of the border. The military instructed Israeli civilians to stay inside their homes.
An Egyptian military official said Egyptian troops were pursuing the militants who returned to Egypt. He said the attackers used three vehicles.
An Egyptian border official said the Rafah terminal between Egypt and Gaza has been closed indefinitely. It is the only crossing from Gaza that is not under direct Israeli control.
A former Egyptian intelligence officer close to the military, Sameh Seif el-Yazel, told state TV the attack began at another checkpoint inside Rafah, where the militants took the armored vehicles and headed toward the border checkpoint. He said the militants drove about 25 meters into Israel before Israeli troops attacked them. Some fled back into Egypt, he said.
Egyptian and Israeli officials have been warning of a deteriorating security situation in Sinai, where militants have taken advantage of a security vacuum in the area following the uprising that toppled longtime President Hosni Mubarak last year.
The security official said the attack set off clashes with the gunmen. He later said one of the armored vehicles was found abandoned near the border with Israel.
All the Egyptian officials spoke on condition of anonymity because they were not authorized to speak to reporters.
In a statement posted on the website of Gaza's Hamas leaders, Hamas condemned "the ugly crime committed today against the Egyptian soldiers, and sent its condolences to the families of the victims, to Egypt's president and to his government." Hamas did not fix blame for the attack.
The attack caused confusion among the security agencies because of its surprise nature. It took place at a checkpoint near the border where Israel, Gaza and Egypt meet.
Late last week Israel issued one of its frequent warnings to Israelis to leave the Sinai.
Since Mubarak stepped down, Israel has allowed Egypt to send in more troops to Sinai, which has been mostly demilitarized according to the 1979 peace deal between the two countries. The Sunday attack spurred renewed calls in Egypt to amend the treaty to allow for more troops in Sinai.
A similar attack took place last year, when Palestinian militants crossed from Gaza into Egypt's Sinai Peninsula, made their way along the Israel-Egypt border, crossed back into Israel, attacked Israeli vehicles and killed eight people on Aug. 18 last year. Israeli forces killed six Egyptians soldiers as they chased the militants, increasing tension between the two countries.
Relations between the two nations have always been cool. Since Mubarak was overthrown and Islamist parties moved to the front of the Egyptian political scene, Israeli officials have expressed concern about the possibility of deterioration in relations, while insisting that maintaining the peace treaty is in the interest of both countries.
Associated Press writers Daniel Estrin in Jerusalem, Ibrahim Barzak in Gaza City, Gaza Strip and Sarah El Deeb in Cairo contributed to this report.