Syriainfo-icon has completed the evacuation of thousands of people from two Shiainfo-icon-majority towns, which have long been besieged by foreign-backed militants, state mediainfo-icon say.

Syria's al-khbariya TVinfo-icon reported on Thursday that all buses had left Kefraya and al-Foua, both in Syria's northwestern Idlib Province, and that the towns had been "empty of civilians."

It also noted that 10 ambulances, carrying those in critical condition, had departed from the besieged towns.

The buses, the report said, are travelling through militant-controlled territory and have not reached a government checkpoint around 30 kilometers away from Kefraya and al-Foua, which have been encircled by terrorists since March 2015.

The evacuees are being taken to government-held territory in Syria's Aleppo Province.

Syria's SANA news agency quoted Hamid Kano, a member of the Aleppo Executive Office, as saying that the province has prepared temporary housing centers to receive the Kefraya and al-Foua residents.

The Syrian government, in exchange, is to release hundreds of militant prisoners.

Dozens of buses arrive in Kefraya and al-Foua as part of an evacuation deal to get locals out of the militant-besieged towns in Idlib.

The so-called Syrian Observatory for Human Rightsinfo-icon, which is sympathetic to the anti-Damascus militants, said some 6,900 civilians and militants had been evacuated from the besieged towns, and that the government had "started releasing detainees, as per the deal."

Last year, the Syrian government and militants reached a deal, known as the "Four Towns Agreement" that allowed the evacuation of the Kefraya and al-Foua locals.

In return, people in Madaya and Zabadani were given safe passage out of the two militant-held towns situated near Damascus.

However, the deal was not fully implemented.

Militant sources claimed Iraninfo-icon had negotiated the recent evacuation deal with the Hayat Tahrir al-Sham terrorist group operating in the region.

But, a pro-Damascus commander and a militant source said separately that Turkeyinfo-icon was also involved in the process.

A militant source familiar with the talks told Reuters that more than 1,500 civilian and militant prisoners would be released under the latest evacuation deal.