Iran is working to restore a lost link in its network of alliances in the Middle East, trying to bring Hamas fully back into the fold after the Palestinian militant group had a bitter fall-out with Iranian ally Syria over that country's civil war.
Iran and its Lebanese ally Hezbollah are quietly trying to mediate a reconciliation between Syria and Hamas. If they succeed, it would shore up a weak spot in the alliance at a time when Iran has strengthened ties with Syria and Iraq, building a bloc of support across the region to counter Israel and the United States' Arab allies.
Hamas had long been based in Syria, receiving Damascus' support in the militant group's campaign against Israel. Hamas' powerful leadership-in-exile remained in Syria even after the group took power in the Gaza Strip in 2007. Together with Iran and the Shiite guerrilla group Hezbollah, they touted themselves as the "Axis of Resistance" to oppose Israel.
But when Syria tipped into civil war, Hamas broke with President Bashar al-Assad and sided with the rebels fighting to oust him. The rebels are largely Sunni Muslims, like Hamas, and scenes of Sunni civilian deaths raised an outcry across the region against Assad, who belongs to the minority Alawite sect.
Iran, meanwhile, has been one of Assad's strongest backers since the crisis in Syria began in 2011, pumping billions of dollars into the economy and sending advisers as well as Iranian-backed fighters to help him stay in power. Hezbollah sent thousands of fighters, helping tip the war in Assad's favor against the rebels and now helping in the fight against the Islamic State group.
The reconciliation attempt comes after Hamas elected a new leadership and as its main backers, Qatar and Turkey -- both strong supporters of the rebels in Syria -- have sought to improve relations with Iran.
Hamas and Iran did not completely cut off their alliance after the fall-out with Assad. But ties cooled considerably. Tehran's funding continued, particularly for Hamas' armed wing, but at a reduced level, while political connections dwindled.
Since Yahya Sinwar took over Hamas leadership in the Gaza Strip in February, the militant group has been rebuilding those relations. In August, the most senior Hamas delegation in years visited Tehran and took part in President Hassan Rouhani's inauguration. During their visit, the delegation met with the parliament speaker and senior aides to Iran's supreme leader, Ali Khamenei. This year, Hamas officials have held three meetings with Hezbollah leader Sheikh Hassan Nasrallah and relations have returned to normal, according to a Palestinian official in Beirut.
Iran has responded by increasing funding. Sinwar told reporters last month that Iran is now "the largest backer financially and militarily" of Hamas' armed wing. He said that with Iran's help, Hamas is "accumulating" its military powers in preparation for a battle meant for "the liberation of Palestine."
Now Iran wants to end the rift between its two allies, Assad and Hamas.
A Lebanese politician with close links to the Syrian government confirmed that Iranian-Hezbollah mediation is ongoing, adding that it is still in the "very early stages."
A Palestinian official who closely follows Hamas' relations in the region also confirmed the mediation effort and said there were "positive signals" from Syria.
Both the politician and the official spoke on condition of anonymity because they were not authorized to discuss the secret mediation.
But the mediation faces a tough task given how bitter the split was.
At first when Syria's conflict began, Hamas' leadership in exile remained largely silent. But tensions grew with the increased bloodshed, and finally in January 2012, Hamas' leader in exile Khaled Mashaal left Syria to Qatar, one of Assad's main opponents.
The following September, he gave a speech in Turkey proclaiming, "We welcome the revolution of the Syrian people who are seeking freedom and independence" and that "the pure blood of these great people is being shed" because they seek democracy.
Within hours, Syrian authorities sealed up all Hamas offices in the country and expelled its members to Lebanon. They have not been allowed back since.
This month, Mahmoud al-Zahar, a senior Hamas figure in Gaza, told Al-Mayadeen TV that relations must be repaired with Syria and other countries that "are hostile to us without a reason." Pressed about possible reconciliation with Syria, Zahar said, "There are steps and they should continue."
Syrian officials told mediators they are open to reconciliation but will not allow Hamas to open an office in Damascus, prominent Palestinian journalist Abdul-Bari Atwan wrote in his online newspaper Rai al-Youm.
Khaled Abdul-Majid, a Palestinian official based in Syria who has close relations with the government, said that in the Syrians' eyes, statements by Hamas toward improving ties "are not enough."