Updated

Israel is quietly and carefully watching the turmoil in neighboring Egypt while maintaining close contacts with the Egyptian military amid concerns that the escalating crisis could weaken their common battle against Islamic militants in the Sinai Peninsula, officials said.

As the week's death toll in Egypt rises, this alliance has put Israel in a delicate position. Wary of being seen as taking sides in the Egyptian military's standoff against Islamist supporters of the ousted president, Israel also needs the Egyptian army to maintain quiet along their shared border — and to preserve a historic peace treaty.

The 1979 peace treaty, Israel's first with an Arab country, has been a cornerstone of regional security for three decades. It has allowed Israel to divert resources to volatile fronts with Syria, Lebanon and the Palestinian territories. For Egypt, it opened the way to billions of dollars in U.S. military aid.

Although diplomatic relations have never been close, the two militaries have had a good working relationship. These ties have only strengthened since longtime President Hosni Mubarak was ousted in a popular uprising two and a half years ago. With both armies battling extremist Jihadi groups in the Sinai Peninsula, near the Israeli border, Israeli security officials often say that relations with their Egyptian counterparts are stronger than ever.

With so much at stake, Israel has remained quiet since the Egyptian military ousted Mubarak's Islamist successor, Mohammed Morsi, in a coup on July 3. Morsi, who became Egypt's first democratically elected president, hails from the Muslim Brotherhood, an Islamist group considered the parent organization of militant Palestinian Hamas that rules the Gaza Strip and is a bitter enemy of Israel.

Israel has not commented on this week's bloodshed, in which the Egyptian troops killed hundreds of Morsi's supporters who were rallying against the coup and demanding that he be reinstated.

"Israel does not have to support the (Egyptian) regime, especially not publicly. It is not our place to defend all the measures taken, this is not our business," said Giora Eiland, a former chairman of Israel's National Security Council.

At the same time, Eiland suggested that international condemnations of the Egyptian military's actions have been excessive. He said Israeli and Western interests are "much closer" to the interests of Egypt's military leader, Gen. Abdel-Fatah el-Sissi and his secular allies.

"Even if we don't share the same values, we can share the same interests," he said. "The Israeli interest is quite clear. We want a stable regime in Egypt."

"In the end of the day, the U.S. has to realize the real potential, reliable partner is the combination of the coalition of secular people in Egypt and the current military regime," he added.

Prime Minister Benjamin Netanyahu's office declined comment but Israeli defense officials confirmed to The Associated Press that security cooperation with Egypt has continued over the past week.

The officials, speaking on condition of anonymity because they were discussing classified information, said the topic was discussed last week with the visiting chairman of the U.S. Joint Chiefs of State, Gen. Martin Dempsey. They refused to discuss the content of the discussions.

The Israeli and Egyptian armies have worked closely in recent years to contain the common threat posed by al-Qaida-linked groups operating in Sinai. These groups have stepped up their activities since Mubarak was toppled, and even more so since Morsi was deposed.

In the latest attack, militants ambushed and killed 25 Egyptian policemen on Monday on a road in northern Sinai, Egyptian officials said, speaking on condition of anonymity as they were not authorized to talk to the media. The militants forced two vehicles carrying policemen on leave to stop, ordered the men out and made them lie on the ground before they shot them to death, the officials said.

Early this month, Israel briefly closed its airport in the Red Sea resort town of Eilat, next to the border with Sinai, in response to unspecified security warnings. The following day, five men believed to be Islamic militants were killed in what Egyptian security official told the AP in Cairo was an Israeli drone attack. The site of the strike was about five kilometers (three miles) inside Egypt. The officials spoke on condition of anonymity as they were not authorized to brief journalists.

Israel has maintained official silence about the strike, likely out of concerns about exposing Egypt's military to domestic public backlash over a strike on Egyptian soil. Egypt's government celebrates its battles fought against Israel over Sinai and despite the 1979 peace deal, many in Egypt still view the Jewish state with suspicion.

A week after the suspected drone strike, Israel intercepted an incoming rocket fired from Sinai at Eilat. An al-Qaida-linked group claimed responsibility for the rocket attack.

Under the terms of the peace accord, Egypt must coordinate its military operations in northern Sinai with Israel. The Israelis are believed to have granted every request by Egypt to bring additional forces into the region, as long as all operations were closely coordinated. An international force helps monitor the terms of the treaty.

Israeli lawmaker Shaul Mofaz, a former defense minister and military chief of staff, said it was essential that peace and order be restored in Egypt.

"The issue of the peace treaty with Egypt is Israel's highest interest. As long as the violence, and the confrontation between the army and the civilians and the bloodshed there increases, it endangers the peace treaty. We have an interest that life there is quiet," he told Channel 2 TV.

The U.S. and European Union have criticized Egypt's crackdown on Morsi's supporters.

President Barack Obama has suspended a planned military exercise with Egypt, and U.S. Sen. John McCain has led a chorus of voices urging a halt in the $1.3 billion in military aid the U.S. sends to Egypt each year.

"For us to sit by and watch this happen is a violation of everything that we stood for," the Republican senator told CNN. "We're not sticking with our values."

Obama has not made a decision. But suggestions like McCain's have raised concerns in Israel that tough U.S. action could shake the alliance with Egypt — and even prompt Egypt to retaliate against Israel.

"The Israeli and Egyptian security establishments are operating inside a bubble and, for the time being, there are no signs that relations between them have cooled," wrote Alex Fishman, a military affairs commentator for the Yediot Ahronot daily. "But the Egyptian street is beginning to press, and the current regime is going to have to toss it a bone. Regrettably, it is going to be an Israeli bone it tosses."

Israeli officials say the peace accord remains intact, and dismiss speculation that it could be threatened.

Eli Shaked, a former Israeli ambassador in Egypt, told the AP the scenario of the Camp David accords unraveling was highly unlikely. He said it was highly doubtful the United States would cut off aid to Egypt and even if it did, he could not envision Egypt canceling the peace treaty.

"They have no interest in engaging in another conflict they have neither the time nor the energy for," he said. "They need us now, with or without American aid."