The outbreak of Syria's civil war nearly four years ago provoked a rupture between Hamas and Iran, after the movement threw its support behind rebels fighting President Bashar al-Assad, a close ally of Tehran.
Wrongly banking on Assad's overthrow, Hamas's exiled leader Khaled Meshaal in 2012 abandoned host Damascus to move his base to Qatar.
And after reports that Hamas's military wing was helping Sunni rebels fighting the Assad regime, financial support from Shiite Iran soon began to dry up.
With Hamas now in dire straits after a destructive war last year with Israel in the Gaza Strip, officials have begun making overtures to Iran and its allies, seeking to return to the axis that links Tehran, Damascus and Hezbollah, Lebanon's powerful Shiite movement.
"In terms of logistics and training, Iran has done more than any other country in supporting the resistance," Hamas official Ahmad Yusef told AFP.
"Iran has always helped us."
But the path to reconciliation is fraught with obstacles and it will take time to fully restore ties, experts say.
"Reconciliation between Hamas and Iran is on its way to being realised, but is going very, very slowly, and faces obstacles which ensure it won't be a fait accompli in the near future," said Adnan Abu Amer, politics professor at Gaza's Ummah University.
Experts say the biggest hurdle is Hamas's position on Assad.
Its gamble on his downfall alienated the movement from longtime backers Tehran, Damascus and Hezbollah, in favour of a closer alignment with Qatar, Turkey and other Sunni supporters of anti-Assad rebels.
"The Iranians still have a quarrel with Meshaal, because they see him as deciding to leave Syria for the Qatar-Turkey-Gulf axis," Abu Amer said.
- Supporting Assad? -
"It seems they're demanding as a precondition... that he publicly declare his support for the Assad regime," which Hamas is refusing to do, he added.
Hamas has for months trumpeted an upcoming meeting between Meshaal and Iran's leaders which has not materialised -- a clear sign of problems, according to Nathan Thrall of International Crisis Group.
A visit by Meshaal to Tehran "would be the signal there's a real shift taking place, and that hasn't come yet," he told AFP.
Signup to our newsletter and follow us on Facebook and Twitter!
"Even in the best-case scenario... relations are unlikely to return to what they once were."
Hamas appears to have had more success mending ties with Iran's Lebanese proxy, Hezbollah.
A Hezbollah website in January published what it said was a letter from Hamas military chief Mohammed Deif calling for forces hostile to Israel to "unite".
Yezid Sayigh, an expert at the Carnegie Middle East Center in Beirut, said Hamas's efforts to rebuild the relationship with Iran and Hezbollah were still at a very early stage.
"More is expected of Hamas than it can give right away, including reversing its stance towards Assad."
Israel's 50-day war with Hamas last July and August left much of Gaza in ruins and severely depleted the Palestinian militants' rocket supply.
Hamas, which controls the coastal enclave, is also unable to pay its security forces due to a lack of cash.
Neighbouring Egypt has since 2013 destroyed hundreds of cross-border smuggling tunnels that were a key supply line for materials, supplies and funds into the Palestinian enclave.
Reconciliation with Iran could mean "that money begins to come from Tehran to Gaza, in the middle of a financial crisis for Gaza," Abu Amer said.
"Iran also has ways and means, through the Red Sea, through Sudan, Sinai, and so on, to send weapons to Hamas."
- Nuclear uncertainty -
Reconciliation prospects are clouded by efforts between world powers and Iran to seal a deal over Tehran's nuclear programme.
"There's huge uncertainty about what Iran's policies are going to be if they reach a deal with the US, and that's uncertainty for Hamas," Thrall said.
A nuclear agreement could either embolden Iran to become "more aggressive" -- pumping money and arms to militant groups such as Hamas -- or to enter a tacit alliance with the US, Thrall said.
And in a Middle East where numerous proxy battles are being fought -- often between Iran's allies on one side and Sunni groups on the other -- Hamas might hedge its bets, Abu Amer said, suggesting the group was optimistic of rapprochement with Riyadh, Doha and Ankara.
Supporting Assad "would be a loss for Hamas in popularity among Arabs and Palestinians," he said.
"It might not be in a rush for reconciliation with Iran if it fears losing support from the Gulf axis."