Just a year ago, tens of thousands of Hamas supporters took to the streets of Gaza for a noisy celebration of the election of fellow Islamist Mohamed Mursi as Egypt’s president.
Stunned silence among Hamas officials in the Palestinian enclave, which shares a border with Egypt’s lawless Sinai peninsula, greeted his overthrow last Wednesday by the Egyptian military.
A shaken Hamas - an offshoot of the deposed leader’s Muslim Brotherhood - is cautiously watching the scenes of street battles between pro- and anti-Mursi demonstrators in Egypt’s cities and pondering how the turmoil will play out and what it means for its own rule in the Gaza Strip.
Egypt holds the key to many aspects of life in the territory, from control of its only border crossing with the outside world to mediating Palestinian unity efforts and brokering truces with Hamas’s Israeli enemy.
It also has a chokehold over an extensive network of tunnels through which weapons and commercial goods are smuggled to skirt an Israeli blockade of the impoverished enclave and Egyptian-imposed border restrictions.
The tunnels are a vital conduit for Gaza’s Hamas government, which opposes the existence of the Jewish state and whose Israeli and Palestinian foes could be emboldened by the weakening of its Muslim Brotherhood ally.
Hani Habeeb, a political analyst in Gaza, said Hamas has weathered change before and could forge a working relationship with whoever governed Egypt.
“Hamas had a strong base in Syria and it quit that country,” Habeeb said, referring to the group’s closure of its Damascus headquarters and exodus of its leaders as the rebellion against President Bashar al-Assad gathered speed.
“I do not think it has been weakened by doing so.”
The split with Assad led to a cutoff in funding for Hamas from his ally Iran, however, increasing the importance of reasonable ties with Egypt, in which a complicated security situation along the frontier is a prominent feature.
Egypt’s military is battling Islamist militants in the Sinai, which has slipped deep into lawlessness since autocratic ruler Hosni Mubarak was toppled in an uprising in 2011.
So while Mursi became the first Egyptian leader to host top Hamas officials in the presidential palace, he also stood back amid internal political storms while the army launched an aggressive campaign to close dozens of tunnels between Sinai and the Gaza Strip.
The tunnels have provided an economic lifeline for the enclave, and Egypt’s military says the network is also used by militant groups on both sides of the frontier to transfer personnel and weapons.
“Gaza represents an issue of national security for Egypt and that will never change,” Habeeb said. “Sooner or later (Egypt’s) new leadership will have to engage with Gaza’s rulers.”
Ghazi Hamad, Hamas’ deputy foreign minister, said he hoped Egypt would continue to play an important role in the territory, which the group seized from forces loyal to Western-backed President Mahmoud Abbas in 2007, a year after winning a Palestinian election.
Egypt, he noted, had brokered a ceasefire with Israel that ended an eight-day war in November and provided a window to the outside world for the movement’s leaders. Cairo also mediated a still unimplemented Palestinian unity deal.
“Egypt is a political heavyweight and its support for the Palestinian people is much needed,” Hamad said. “Egypt has always stood beside us in times of war and peace and we are keen to maintain such a relationship regardless of who rules there.”
Hani al-Masri, a political analyst based in the occupied West Bank, said events in Egypt had come as a “political and ideological shock” for Hamas, but it recognised that a standback approach, for now, was prudent.
Mursi’s tenure did not bring Hamas the big benefits it might have expected; the latest clampdown on the tunnels by the army was tougher than their closure under Mubarak.
Hamas reported an increase in the number of people allowed to cross the border at Rafah, but Egyptian security authorities rebuffed its appeals for goods to be allowed through the terminal or for a trade zone to be built.
Mubarak, who oppressed the Muslim Brotherhood in Egypt for decades, maintained minimal contacts with Hamas through intelligence officers, who Hamas said favoured the rival Palestinian Fatah movement.
But he backed broader Palestinian demands for statehood, while supporting a 1979 peace treaty with Israel which Mursi also pledged to uphold.
Hamad said Hamas had made a point of staying out of the internal affairs of other Arab countries - a policy “that has always protected us from getting into trouble”.
Nonetheless, Hamas acknowledged last month that its relations with financial backer Iran had suffered as a result of the group’s support of rebels battling Assad, Tehran’s long-time ally.
A diplomatic source in the region said Iran had provided Hamas with up to $20 million a month to help pay the salaries of nearly half of 50,000 Gaza government employees. It also gave Hamas weapons, including rockets used against Israel.
The Muslim Brotherhood was widely believed to have provided funds for Hamas before the 2011 revolution that ousted Mubarak.
But diplomatic sources said that after Mubarak’s downfall, the Brotherhood focused more on funding its supporters in Egypt, as well as on uprisings in Syria and elsewhere.
Yadlin said Hamas could exercise some political leverage with Egypt’s future leaders by trying to win back Iranian support. Relations between Iran and Egypt have been rocky and Tehran called Mursi’s toppling improper.
As for any knock-on effect on politics in Gaza from the new, tumultuous chapter of the Arab Spring in Egypt, Habeeb said anti-Hamas rallies - as some social activists have urged on Facebook - were unlikely.
“Any such move would be met by absolute force by Hamas,” he said.