Tensions are high in Gaza following the violent repression of the Muslim Brotherhood by the Egyptian military, with divisions inside the tiny coastal strip reflecting splits within the population of its vast neighbour to the south.

Officially Hamas, the Islamist party that has ruled Gaza for more than six years, says it has no intention of becoming involved in Egypt's internal affairs. But the toppling of President Mohamed Morsi and the crackdown on the Brotherhood, close ideological allies of Hamas, has been a massive blow and it is extremely nervous about the impact of the bloody turmoil next door.

Sermons following Friday prayers at mosques across the territory lambasted General Abdel Fatah al-Sisi, the Egyptian military leader, and defended the Muslim Brotherhood. The website of Hamas's military wing, the Izzadeen al-Qassam Brigades, reported that scores of Palestinians joined marches in support of Morsi.

Hamas hailed the electoral success of the Muslim Brotherhood last year as evidence of the rise of political Islam in the Middle East following a string of uprisings against the established order. An end to Hamas's international isolation would inevitably follow, it argued.

However, some in Gaza – where support for Hamas is far from universal – support the Egyptian army's crackdown.

Among ordinary people, many of whom have family, education and business ties in Egypt, an important consequence of the turmoil has been the de facto closure of the Rafah crossing, the main passage not only to Egypt but to the rest of the world.

Around 50 foreign passport holders and humanitarian cases were allowed to cross through Rafah on Saturday, but about 100 people were waiting at the border on Sunday amid an atmosphere of rising frustration.

Israel is also closely monitoring events in its biggest and strategically most important neighbour. The Israeli security cabinet was briefed for two hours on Friday, and the prime minister, Binyamin Netanyahu, has instructed ministers to refrain from commenting publicly on the situation.

Israel's immediate concern is continuing instability across the border in the vast and lawless Sinai desert, but it also fears the potential loss of Egypt as a stable and largely peaceful actor in the region. "To our dismay, Egypt is walking down the road towards possible anarchy," said an Israeli government official, speaking on condition of anonymity. "This has implications not just for Egypt but the whole region. More chaos means more room for terror organisations and global jihadists to operate."

He added: "As much as we dislike the message of the Egyptian army, there is no other option. It is a simple but cruel formula: army or anarchy."

Israel was working closely with the United States and Europe, he said. "We hope they hear what we have to say. The view from here is very different from afar: we are right on the border."

Co-operation between the Israeli and Egyptian armies, which continued throughout Morsi's year in office, is still functioning despite the internal focus. Alex Fishman, defence analyst for the Yedioth Ahronoth newspaper, said: "For the time being, there are no signs that relations between [the Israeli and Egyptian security establishments] have cooled, since the Egyptian army has shared strategic interests with Israel, even apart from its relations with the United States."

But he said the military authorities may deem it shrewd to respond to popular anti-Israel opinion. "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," he wrote.