Updated

Israel and Egypt's leadership tried Saturday to limit the damage in ties after protesters stormed Israel's embassy in Cairo, trashing offices and prompting the evacuation of nearly the entire staff from Egypt in the worst crisis between the countries since their 1979 peace treaty.

The 13-hour rampage deepened Israel's fears that it is growing increasingly isolated amid the Arab world's uprisings and, in particular, that Egypt is turning steadily against it after the fall of Hosni Mubarak, the authoritarian leader who was a close ally.

In Israelis' eyes, the scene of cars burning outside the embassy and the tale of six Israeli guards trapped inside for hours in a steel-doored safe room underscored their view that anti-Israeli sentiment in Egypt was running free after decades of being contained by Mubarak's regime. The ousted leader's powerful security forces never would have let a protest get near the Nile-side embassy.

Egypt's new military rulers, in turn, appear caught between preserving key ties with Israel -- which guarantee them billions in U.S. military aid -- and pressure from the Egyptian public. Many Egyptians are demanding an end to what they see as too cozy a relationship under Mubarak, who they feel knuckled under to Israel and the U.S., doing nothing to pressure for concessions to the Palestinians.

Egyptian security forces did nothing as hundreds of protesters massed Friday outside the Nile-side high rise residential building where the Israeli Embassy is located and tore down a concrete security wall Egyptian authorities erected there only weeks earlier. Many protesters saw the wall as a symbol of the government's willingness to protect Israelis but not Egyptians, since it was put up to keep back protests after Israeli forces chasing militants accidentally killed five Egyptian soldiers in the Sinai Peninsula.

Police and military also did little initially when a group of around 30 protesters after nightfall climbed in a third-story window and raced up to the embassy floors, broke into an office and began throwing Hebrew-language documents to the crowd below. The protesters ransacked parts of two floors of the embassy for hours until police finally managed to clear them out in the early hours Saturday.

Frantic Israeli calls to President Barack Obama brought American intercession to help ease the violence.

An Egyptian security official said the ruling military did not order the police to clamp down on the protests outside in order to "avoid a massacre." They couldn't move more quickly to clear out protesters inside the embassy because the fervent crowd outside "considered them heroes," he said, speaking on condition of anonymity because he wasn't authorized to talk to the press.

But in a Saturday evening television address, Israeli Prime Minister Benjamin Netanyahu avoided any condemnations and instead stressed the need to maintain its strategic relationship with Egypt, whose peace with Israel -- though sometimes chilly -- has been a vital peg of stability for the Jewish state.

"We will continue to keep the peace with Egypt it is an interest of both countries," Netanyahu said.

He thanked Egyptian commandos for rescuing the six trapped embassy guards, saying they "prevented a tragedy without a doubt" and stressed that Israeli officials had been in touch with Egyptian counterparts throughout the unrest.

Still, he and his Foreign Minister Avigdor Lieberman hinted the American intervention prompted Egyptian authorities to act. Both profusely thanked President Barack Obama for helping.

"I asked him to help, it was a decisive moment, I would even say fateful, he said he would do everything he could to help and he did so. He deployed all means and influence and I think we owe him a special thank you," Netanyahu said.

Lieberman said that after Netanyahu's call to Obama, "we immediately felt a change, a little more movement on the Egyptian side and I think that without elaborating the U.S. representatives did extraordinary work and they deserve the credit."

Both said Israel would send back its ambassador once conditions are right. The ambassador and the entire embassy staff except for one deputy ambassador were evacuated overnight from Egypt along with their families.

From the Egyptian side, the ruling military council and civilian government underlined in a statement read on state TV that Egypt is committed to international conventions and the protection of diplomatic missions.

They also vowed to crack down on future protests at the embassy, warning that Egypt was experiencing a "real predicament that threatens the very body of the state that requires decisive actions." To "safeguard the state," they said they would re-invigorate parts of hated emergency laws, which for months the military has promised to abolish in a concession to demands for reform.

Mubarak was a close ally of the Israelis, building economic ties and cooperating with them on security, particularly helping in the Israeli blockade of the Gaza Strip. Since his Feb. 11 fall, ties between the two countries have steadily worsened as Egypt's new military rulers ease off his pro-Israeli policies, including opening the border with the Hamas-ruled Gaza Strip.

Anger flared last month after the deaths of the five Egyptian police officers in Sinai, killed by Israeli forces chasing Gaza militants who carried out a deadly attack in Israel. Mass protests flares in Cairo, demanding the expulsion of the Israeli ambassador. The military nearly pulled Egypt's ambassador to Israel in protest. Calls have even grown in Egypt for ending the historic 1979 peace treaty with Israel.

The deterioration with Egypt comes as Israel has also been hit by a major downturn in ties with longtime Turkey. After Israel refused to apologize for its deadly raid on a Gaza-bound aid flotilla last year that killed eight Turks and a Turkish-American, Turkey expelled several senior Israeli diplomats, suspended military cooperation with Israel and boosted naval patrols in the eastern Mediterranean in response.

Israel is also feeling the heat from Palestinian plans to unilaterally seek recognition of an independent state at the United Nations this month amid a long stalemate in the peace process. Israelis also fear that the Arab spring could bring rising influence to Islamic fundamentalists in the region.

For Egypt, the rioting could worsen ties between the ruling military and young protest activists, who are sharply critical of its handling of the post-Mubarak transition. Increased use of emergency laws is likely to anger many.

Clashes outside the embassy lasted for hours when police and military finally moved in, leaving three people dead, more than 1,000 hurt and 30 arrested. Police and army troops fired tear gas and shot live ammunition in the air trying to disperse the crowd of thousands, as cars, police vehicles and trees on the streets were set ablaze.

Saturday morning, the streets around the embassy were littered with debris and charred cars. Dozens of police vehicles and armored troop carriers lined up the streets leading to the embassy and the nearby police headquarters in Giza.