If a media investigation is to be believed and as it has claimed, American, British, and local Kurdish forces have sneaked out hundreds of Islamic State (ISIS) terrorists out of Raqqa in Syria.

This happened in October as part of a deal struck by the US and UK armed forces. ISIS militants and their families were secretly vacated from the de facto capital of the terrorist group after it was bombarded in October and freed to "spread out far and wide across Syria and beyond," according to a BBC documentary titled 'Raqqa's Dirty Secret'.

Foreign ISIS fighters not belonging either to Syria or Iraq were also allegedly able to join the escape convoy.

"There was a huge number of foreigners. From France, Turkey, Azerbaijan, Pakistan, Yemen, Saudi, China, Tunisia, Egypt," a local driver told the BBC.

The report describes in detail how the escape convoy of trucks carrying 250 fighters, 3,500 family members, and loads of arms and possessions, was arranged on October 12 by local officials in meetings attended by a western officer.

The aim was to spare the lives of attacking forces and end the four-month battle over Raqqa, a crucial stronghold of the terrorist network.

"Great pains were taken to hide it from the world. But the BBC has spoken to dozens of people who were either on the convoy or observed it, and to the men who negotiated the deal," the makers of the documentary claim.

The Kurdish-led Syrian Democratic Forces (SDF) had cleared Raqqa of media so that the ISIS escape from its base would not be televised.

It claimed that only a few dozen fighters had been able to leave, all of them locals.

But a local driver told the BBC that the convoy was six to seven kilometres long and included almost 50 trucks, 13 buses, and more than 100 of ISIS' own vehicles.

ISIS fighters, their faces covered, sat defiantly on top of some of the vehicles.

"Footage secretly filmed and passed to us shows lorries towing trailers crammed with armed men. Despite an agreement to take only personal weapons, IS fighters took everything they could carry. Ten trucks were loaded with weapons and ammunition," the report said.

The SDF did not want the retreat from Raqqa to look like an escape to victory.

No flags or banners were allowed to be flown from the convoy as it left the city, the deal struck by local officials had stipulated.

In light of the BBC investigation, the US-led coalition fighting in Syria admits the part it played in the deal.

"We didn't want anyone to leave. But this goes to the heart of our strategy, 'By, with and through' local leaders on the ground. It comes down to Syrians they are the ones fighting and dying, they get to make the decisions regarding operations," Colonel Ryan Dillon, spokesperson for Operation Inherent Resolve, the Western coalition against ISIS, was quoted as saying.

He maintains that while a Western officer was present for the negotiations, they didn't take an "active part" in the discussions and that only four foreign fighters were allowed to leave in the convoy and they are now in SDF custody.

According to the report, the deal to free the ISIS fighters was about maintaining good relations between Kurds leading the fight and Arab communities who surround them. It was also about minimising casualties.

"ISIS was well dug in at the city's hospital and stadium. Any effort to dislodge it head-on would have been bloody and prolonged," the BBC report said.

"But it has also meant battle-hardened militants have spread across Syria and farther afield and many of them aren't done fighting yet," it added.