The ouster by the Egyptian Armed Forces of Islamist president Mohamed Morsi has crushed the dreams of Gaza's Hamas rulers, who will now have to build ties with the new Egyptian authorities, analysts say.
Hamas, which is affiliated to the Islamist Muslim Brotherhood from which Morsi hails, has lost a valuable ally in the deposed Egyptian president after feting his election to office in June 2012, they say.
"What happened in Egypt is a nightmare for Hamas which it did not expect," said Mukhaimer Abu Saada, political science professor at Al-Azhar University in Gaza.
On Wednesday, the Egyptian army ousted Mors, after just one year in office, following days of popular protests against him in Cairo and other cities.
"Over the past year Hamas had established a good relation with Morsi and the Muslim Brotherhood" in Egypt, said Saada.
Hamas chief Khaled Meshal and Gaza's premier Ismail Haniyeh both held a series of meetings with Morsi over the past year, establishing "official cooperation" between the two governments, he said.
"The new Egyptian government will not have good relations with Hamas" when it comes to Gaza, Saada said.
Saada noted that Hamas had been the target of a ferocious campaign in the Egyptian media, which accused it of meddling in Egypt's internal affairs before and after the 2011 uprising that ousted Hosni Mubarak.
On 23 June, an Egyptian court ruled that Hamas and Lebanon's Hizbullah movement had with the Muslim Brotherhood been involved in facilitating the escape of prisoners, including Morsi, from jail during the anti-Mubarak uprising.
Soon after Morsi was detained by Egypt's army after it announced his overthrow Wednesday following days of mass streets protests, a military official said he may be charged over the jailbreak.
"What happened in Egypt is a blow to the Muslim Brotherhood, especially in the Gaza Strip," said Palestinian political analyst Hani Habib.
"The security situation in Sinai serves as justification (for Egypt) to put pressure on Hamas," he said.
"Egyptian security measures could affect Hamas through imposing restrictions on movement of its members."
On Friday, Egyptian authorities closed the Rafah Crossing to Gaza following attacks in the Sinai peninsula in the wake of Morsi's dismissal.
Haniyeh on Friday tried to strike an upbeat note despite the setback to Islamists in the region.
"Do not fear for the Palestinian cause or for the resistance (against Israel) or for Gaza. Egypt is behind us, as are the Arab and Islamic countries," Haniyeh said in a Friday sermon.
"We believe good will emerge from this Arab Spring, these revolutions and this rebirth. We expect the Arab Spring cycle to continue until its objectives are attained, including our own cause."
In its favour, Hamas, aware that it could become a "pawn" in the internal political battle in Egypt, had established contacts with the opposition there, Mussa Abu Marzuk, a leader from the movement in Cairo, told AFP in April.
Analysts predict that Hamas will manage to find a modus vivendi with the new authorities in Egypt, as it did during the Mubarak era.
"Hamas is not obliged to be with the Muslim Brotherhood; after all, it has long been on the side of the Syrian regime," said Saada. The Muslim Brotherhood is one of the forces ranged against Assad's regime.
"Relations will not be as bad as during Mubarak's rule, whatever the new situation in Egypt will be," said Mustafa Sawaf, political analyst and former editor of a newspaper close to Hamas.
"The Palestinian file and the Gaza Strip is a security issue dependent on the Egyptian intelligence services, which have not changed since the Mubarak era."