Stunned by turmoil in neighboring Egypt and starved of funds, the Palestinian Islamist group Hamas is looking to repair damaged ties with its traditional Middle East allies, Iran and the Lebanese Hezbollah party.
An off-shoot of the Muslim Brotherhood, Hamas celebrated when the Sunni movement's Mohamed Morsy was elected president of Egypt in 2012, believing the vote would boost its own international standing and its grip on the isolated Gaza Strip.
In the meantime, outraged by the bloody civil war in Syria, the Palestinian group quit its headquarters in Damascus, snapping the Iran-led "axis of resistance" that challenged Israel and the West across the turbulent region.
Shia Muslim Iran, which had for years supplied Hamas with cash and arms, was infuriated by what it saw as a betrayal of its close friend, Syrian President Bashar al-Assad, and drastically scaled back its support. Tehran's Shia partner, Hezbollah, also voiced its fierce disapproval.
But following the ousting of Morsy, removed by the Egyptian military on 3 July, political sources said Hamas had had direct and indirect contacts with both Iran and Hezbollah — anxious to revitalize old alliances and restore its battered funding.
"Some meetings have taken place … to clear the air. There is no boycott [of Hamas] but at the same time, things have not yet got back to normal," said a Palestinian official, with knowledge of discussions, who declined to be named.
Moussa Abu Marzouk, former deputy head of Hamas's political office, saw Hezbollah and Iranian officials in Lebanon last month, with other meetings taking place subsequently.
"It is in the interest of Hamas today to revise its rapport with Iran and Hezbollah for many reasons," said Hani Habib, a political analyst based in the Gaza Strip. "At the end of the day, all the parties have an interest in this partnership."
SYRIA ROW
Locked in conflict with arch foe and neighbor Israel, which it refuses to recognize, Hamas has governed the small, densely populated Gaza Strip since 2007 after a brief civil war against its secular rivals.
With the Muslim Brotherhood in control of Egypt, Hamas felt it did not have to worry so much about its ties with Iran.
Hamas's leader in exile, Khaled Meshaal abandoned his long-time base in Damascus last year because of the civil war that pitted President Assad's forces, backed by reinforcements sent by both Iran and Hezbollah, against mainly Sunni rebels.
Shia and Sunni are the main streams of Islam. There are differences in their interpretations of the Koran and some traditions. The majority of the world's Muslims are Sunni.
One of the veteran leaders of Hamas, Mahmoud Al-Zahar, said there had never been a suspension of relations with Tehran and Hezbollah, suggesting that contacts may have slowed only because of the recent presidential election in Iran.
"We do not yet know the nature of Iran's new policy, but the information we have received, which is not direct, suggests that the old policy will be endorsed by the new administration," Zahar, a renowned hardliner, told Reuters in an interview.
Hamas hopes newly installed President Hassan Rouhani will open the financial taps again.
Diplomats estimated that Iran used to give Hamas some $250 million a year, but one Palestinian official reckoned that only 20 percent of that was now being handed over. Ehud Yaari, a Middle East expert from Israel, put the figure at just 15 percent, with no arms being offered up either.
"We have a situation of close to zero arms trafficking through the tunnels into Gaza," said Yaari.
Very little material, weapons or otherwise, is passing at present through the smuggling tunnels that criss-cross the desert border between Egypt and Gaza, with the new rulers in Cairo ordering a clampdown following Morsy's removal.
The army-backed government has accused Hamas of interfering in Egyptian affairs and suggested that Palestinians might be helping Islamist militants active in the Sinai Peninsula.
The restrictions on the tunnels, which flourished thanks to an Israeli blockade on the coastal enclave, cost Gaza at least $230 million in July alone, said Hamas Economy Minister Ala Al-Rafati. But he rejected any suggestion of a financial crisis.
"There are some problems and they are being overcome," he told Reuters on Monday, adding that the tunnel trade, which provides Hamas with a crucial source of tax income, had dropped some 60 percent since Morsy's ousting.
In an additional blow, Hamas's close ties with Qatar have also been dented this summer.
The emir of the energy-rich Gulf state visited Gaza last October promising millions of dollars of aid, but he abdicated in June and his heir has shown much less interest in Hamas.
PRIORITIES
In reaching out once more to Iran and Hezbollah, Hamas's dilemma is as much ideological as political — how to balance its Sunni Muslim Brotherhood roots with its vital interests to forge partnerships with fellow enemies of Israel.
Leading a special prayer meeting on Friday for the souls of the "Egyptian martyrs," the Hamas prime minister in Gaza, Ismail Haniyeh, made clear that the war with Israel took precedence.
"We understand that the priority of our resistance is to liberate the land, regain the rights and return the Palestinian people to the land they were forced out of," said Haniyeh, the movement's deputy chief.
"We have no military and no security role in Egypt or in the Sinai. Our military and security role is here, on the land of Palestine and against the Zionist enemy."
Founded in 1988, Hamas has regularly squared off against Israel, most recently in November last year in an eight-day conflagration that killed at least 170 Palestinians and six Israelis. The truce was brokered by Morsy.
Israeli analyst Yaari thought Iran would exact a price for welcoming Hamas back into the fold. "It will require them to stop opposing Assad and stop any criticism of Hezbollah's intervention [in Syria] and Iranian support of Assad," he said.
Zahar, who lost two sons in the conflict against Israel in past years and carries great weight in the movement, has always sought to maintain good ties with Iran.
But he also says the organization, which is estimated to have around 30,000 well-equipped fighters, has survived difficult situations in the past when U.S.-backed strongman Hosni Mubarak ruled Egypt and kept Gaza in a vice.
"We became very strong in an era where the entire surrounding environment was hostile," he said. "Our resistance relies mainly on God and also on its capabilities. History proved we have always emerged stronger every time."