JERUSALEM -- Israel apologized to Egypt Saturday for the deaths of three Egyptian soldiers during a cross-border clash with Palestinian militants, hours after Cairo threatened to withdraw its ambassador to protest the killings.
Israel said the militants, who attacked on Thursday, came from the Gaza Strip and went through Egypt's Sinai desert, which borders both Israel and Gaza. They then crossed into southern Israel, where they killed eight Israelis. There are conflicting reports of how the Egyptian soldiers were killed later that day, as Israel was pursuing militants along the border with Sinai.
"Israel deeply regrets the deaths of the Egyptian officers," Defense Minister Ehud Barak said in a statement after Egypt threatened to recall its ambassador. The Egyptian government initially put an announcement on its website overnight saying it had pulled the envoy, but later backtracked and issued a new statement saying it was only considering the move.
The violence is testing Israel's landmark 1979 peace treaty with Egypt, already strained by the fall of longtime autocratic leader Hosni Mubarak.
The attacks have also raised concerns about the increasingly lawless northern Sinai, whose porous borders with both Israel and the Hamas-ruled Gaza Strip make it an attractive staging ground for Palestinian militant attacks on Israel.
The fall of Mubarak in a popular uprising in February has given way to a chaotic transition with many in the discredited police force disappearing from the streets and leaving a tremendous security vacuum throughout the country, including Sinai.
Egypt last week moved thousands of troops into the Sinai Peninsula as part of a major operation against al-Qaida inspired militants who have been increasingly active since Mubarak's ouster.
At the same time, anti-Israel sentiment is up in Egypt after Mubarak's ouster and Israel is watching closely for signs that the military rulers who took power might be responding to that sentiment.
The ambush has also threatened to stoke the Mideast conflict as retaliatory violence between Israel and Gaza militants spiked. Israeli airstrikes killed at least 12 Palestinians, most of them militants, Friday in Gaza. Palestinian armed men have fired about 50 rockets into southern Israel since Thursday, wounding more than a dozen people, including three Palestinians illegally residing there.
Israel said the clashes on Thursday began when militants who crossed from Sinai were armed with guns, explosives, mortars and an anti-tank missile and launched a series of attacks on cars and buses.
Israel accused a Hamas-allied group, the Popular Resistance Committees, of carrying out the ambush. Hamas praised the attack -- the deadliest on Israel since 2008 -- but denied involvement.
There have been differing accounts of how the Egyptian soldiers were killed. Egypt says it was an Israeli airstrike along the Sinai border in response to the attacks.
Israel has offered conflicting accounts. One said there was an exchange of fire between its soldiers as they pursued the militants along the border. A senior Israeli military officer said it was possible that Egyptian soldiers had been killed accidentally.
An Israeli military officer, speaking on condition of anonymity in line with military regulations, said Friday that a suicide bomber, not Israeli soldiers, killed the Egyptians. He said the attacker had fled back across the border into Egypt and detonated his explosives among the Egyptian troops.
Israeli media also reported that some of the sniper fire directed at the Israeli motorists Thursday originated near Egyptian army posts and speculated that the Egyptian troops were killed in the crossfire.
It was not possible to reconcile the different versions.
Barak said he has ordered a military investigation and a joint inquiry with the Egyptian army to clarify the circumstances of Thursday's violence. The Israeli military officer said Israeli and Egyptian military officials were "meeting and talking all the time." The officer spoke on condition of anonymity, under military rules.
A representative from the office of Sinai's general prosecutor Judge Abdel Nasser el-Tayel said that Egyptian investigators have not been able to reach the site of the attacks because of the tense security situation. The official also spoke on condition of anonymity.
The attacks and Israel's response have strained what was always a cold peace with Egypt. Egypt was the first Arab nation to make peace with Israel in 1979. And Israel valued Mubarak as a source of stability with shared interests in containing Iran and its radical Islamic proxies in the region -- including the Hamas militants who run Gaza.
The agreement called for Israel to return the captured Sinai to Egypt. In return, Egypt agreed to certain restrictions on the number of troops placed in Sinai.
Egypt's interim government accused Israel of violating the peace treaty by killing the soldiers and demanded an apology. Overnight, the Cabinet published a strongly worded statement on its website that said it held Israel "politically and legally responsible." It blamed Israel for lax security on its side of the border that Egypt said allowed the ambush.
However later in the day, the government backtracked and said it was only considering the recall.
The Egyptian Cabinet, which was appointed by the ruling military council that took over power after Mubarak's ouster, revised an earlier statement saying the envoy, is summoning Israel charge d'affaires to protest the killings, demand an apology and an investigation.
Israeli officials insisted the peace treaty was "stable" despite the troubling developments.
"No one had any intention to harm Egyptian security personnel," Amos Gilad, a senior Israeli Defense Ministry official who works closely with Egypt, told Israel Radio.
Thousands of protesters gathered outside the Israeli Embassy in Cairo for a second day, demanding the expulsion of the Israeli envoy. A Palestinian flag was unfurled at the site, and some of the demonstrators threw firecrackers at the building.
Some protesters removed concrete blocks from the entrance of a side street leading to the embassy while others banged on a metal fence with bars, but no violence was reported. A dozen armored vehicles were stationed in the area and soldiers formed a cordon in front of the main gates to prevent any protesters from reaching the embassy building.
Several Egyptian political parties issued statements condemning the Israeli raid and calling for changes to the peace treaty, which regulates the number of Egyptian troops allowed in the Sinai Peninsula.
"This crime should be dealt with in an appropriate way," said the Muslim Brotherhood, Egypt's best-organized political force. "What was possible before the revolution will not be allowed to continue after the revolution."