Damascus and Hezbollah allowed nearly 300 lightly armed militants and 300 relatives to leave the Syria-Lebanon border in a surrender deal, after an offensive there last month.

The transfer marked the first time Islamic State publicly agreed to such an evacuation from territory it held.

A U.S.-led coalition had stopped the 17 buses from reaching Deir al-Zor for weeks and the convoy split in two. It was not immediately clear if all the buses arrived in Islamic State territory in the eastern Syrian province on Wednesday.

“The deal has been completed,” said the commander in the military alliance fighting in support of the Damascus government.

The buses took the route between the town of al-Sukhna and Deir al-Zor, a main road that the Syrian army and allied forces captured in recent days, the commander said.

Along the route, the combatants swapped the evacuees for a Hezbollah prisoner who had been in Islamic State captivity, the non-Syrian commander added.

Under the evacuation deal in August, Islamic State militants left their border foothold after a week-long battle in return for safe passage to Deir al-Zor province in Syria.

Iran-backed Hezbollah has played a major role in fighting Sunni militants along the border. Since early in the six-year Syrian conflict, it has sent thousands of fighters to support President Bashar al-Assad’s government.

Lebanon’s Shi‘ite Hezbollah retrieved the remains of some of its forces killed in Syria as part of the swap, and was meant to get back one of its fighters that Islamic State held captive.

The deal included recovering the bodies of nine Lebanese soldiers that Islamic State captured in 2014.

The transfer ended any insurgent presence from the Syrian war on the frontier, where the Lebanese army also fought the militants in a separate offensive on its side.

But the U.S.-led coalition against Islamic State blocked the convoy from entering IS territory in east Syria, near the border with Iraq, by cratering roads and destroying bridges.

The convoy split in two, with 11 buses remaining in the open desert and others retreating into government territory.

Last week, the U.S. coalition said its surveillance aircraft moved away from the buses in the no-man’s land after pro-Syrian government forces “advanced past” the convoy. Damascus was responsible for the evacuees, it said.

The Syrian army and its allies reached Deir al-Zor city, breaking an Islamic State siege of an enclave there that had lasted three years.

U.S.-backed Syrian militias have also launched a separate assault in another part of Deir al-Zor province, which has become Islamic State’s last major foothold in Syria.