AMMAN (Reuters) - Syrian rebels and Iranian-backed negotiators have reached a deal to evacuate thousands of people from two rebel-besieged Shi’ite villages in northwestern Syria in return for the release of hundreds of detainees in state prisons, opposition sources said.

FILE PHOTO - People that were evacuated from the two villages of Kefraya and al-Foua walk near buses, after a stall in an agreement between rebels and Syria's army, at insurgent-held al-Rashideen, Aleppo province, Syria April 15, 2017. REUTERS/Ammar Abdullah

They said the negotiators from Hayat Tahrir al-Sham, a rebel coalition spearheaded by Syria’s former al Qaeda offshoot Nusra Front, and Iran’s Revolutionary Guards had agreed all residents would be evacuated from the mostly Shi’ite villages of al-Foua and Kefraya in Idlib province.

A commander in the regional alliance that backs President Bashar al-Assad said 100 buses were heading to the two towns to evacuate around 6,000 alongside 300 Alawite civilians held by rebels.

“We now are working on the logistical arrangements,” said an Islamist rebel source familiar with the secret negotiations that Turkey was also involved in and which builds on a deal reached last year that was never fully implemented.

In April 2017, thousands of people in the two Shi’ite towns were evacuated to government-held areas in a swap that in exchange freed hundreds of Sunnis living in former rebel-held Madaya and Zabadani who were then besieged by Lebanon’s Iranian-backed Hezbollah group.

But the evacuation of the remaining 7,000 people in al-Foua and Kefraya in exchange for the release of 1,500 detainees prisoners never went through.

The resumption of talks now to complete the deal was to ward off a possible military campaign by the Syrian army and Iranian backed militias to end the siege of the two Shi’ite towns, another opposition source said.

An opposition source familiar with the talks told Reuters t more than 1,500 civilian and rebel prisoners would be released.

The deal also includes the release of 34 prisoners captured by Hezbollah during its siege of the Madaya and Zabadani.

There was no official word on the deal but state-owned Ikhabriyah television station said there were “reports of an agreement to liberate thousands from the two towns”.

Iran, which backs Assad against the mainly Sunni insurgents and has expanded its military role in Syria, has long taken an interest in the fate of its co-religionists in the two towns.

It has arranged dozens of air lifts of food and equipment to circumvent the rebel siege of the two towns.

Past deals have mostly affected Sunni Muslims living in former rebel-held areas surrounded by government forces and their allies after years of sieges that have in some cases led to starvation.

Damascus calls them reconciliation deals. Rebels said it amounts to forced displacement of Assad’s opponents from main urban centres in western Syria and engenders demographic change because most of the opposition, and Syria’s population, are Sunni.

But backed militarily by Russia and Shi’ite regional allies, Assad, a member of Syria’s Alawite minority, has negotiated the deals from a position of strength.