U.S.-backed militias in Syria launched what they described as a final assault on Sunday against an Islamic State militant group (ISIS) pocket inside Raqqa to clear the city of the remaining jihadists. 

"The battle will continue until the whole city is clean of the terrorists who refused to surrender, including the foreign fighters," a statement by the Syrian Democratic Forces (SDF) said. 

A convoy of Islamic State fighters evacuated Syria's Raqqa overnight, the SDF said earlier, with the negotiated withdrawal bringing the battle near to its end.

10_12_Raqqa_Isis_Flag

A member of the US-backed Syrian Democratic Forces (SDF), made up of an alliance of Arab and Kurdish fighters, removes an Islamic State group flag in the town of Tabqa, about 55 kilometres (35 miles) west of Raqa city, on April 30, 2017

"The battle will continue until the whole city is clean," said a statement by the Syrian Democratic Forces (SDF), a U.S.-backed alliance of Kurdish and Arab militias. 

SDF spokesman Talal Selo told Reuters that 275 Syrian ISIS fighters had withdrawn from the city along with civilian family members, leaving "no more than 200-300" foreign militants to fight on. 

Under the terms of their withdrawal, all other civilians left in Raqqa were to be allowed safe passage out of the city, Selo said, adding that he believed only a few remained. 

Raqqa's fall to the SDF now looks imminent after four months of battle. 

"We still expect there to be difficult fighting," said Colonel Ryan Dillon, spokesman for the U.S.-led international coalition backing the SDF in the war against ISIS. 

Raqqa was the first big Syrian city to fall to ISIS as it declared a "caliphate" and rampaged through Syria and Iraq in 2014, becoming an operations center for attacks abroad and the stage for some of its darkest atrocities. 

But ISIS has been in retreat for two years, losing swathes of territory in both countries and forced back into an ever-diminishing foothold along the Euphrates river valley. 

"Last night, the final batch of fighters (who had agreed to leave) left the city," said Mostafa Bali, another SDF spokesman. 

There were conflicting accounts as to how many people left in the convoy and who they were. 

Selo said 275 Syrian fighters left along with their family members. Laila Mostafa, head of the Raqqa Civil Council, formed under SDF auspices to oversee the city, said that figure included both the fighters and their family members. She said an earlier comment by another council member that some foreign fighters had left in the convoy was wrong. 

Before the convoy left, the coalition estimated that about 300-400 fighters remained. 

The convoy would head to the remaining ISIS territory in eastern Syria, Omar Alloush of the Raqqa Civil Council said on Saturday. 

It was still in territory held by the SDF on Sunday morning, Selo said. Bali described the civilians who left with Islamic State fighters in the convoy as human shields. 

The jihadists had refused to release them once they left the city as agreed, wanting to take them as far as their destination to guarantee their own safety, he said. 

Such withdrawals of fighters along with groups of civilians have grown commonplace in Syria's six-year war, as a way for besieging forces to accelerate the fall of populated areas. 

The agreement was brokered by the Raqqa Civil Council and tribal elders to "minimise civilian casualties", the coalition said on Saturday. Tribal leaders from Raqqa said they sought to prevent bloodshed among civilians still trapped in the city. 

"If there are any civilians remaining (in the enclave) they would be the families of those foreigners. The civilians exited completely," said Selo. 

The SDF's decision to hasten the battle's end by allowing ISIS fighters to leave Raqqa was at odds with the stated wishes of the U.S.-led coalition that backs the militias with air strikes and special forces. 

Dillon said on Sunday it was not involved in the evacuation but added: "We may not always fully agree with our partners at times. But we have to respect their solutions." 

In August, the coalition spent weeks preventing a convoy of ISIS fighters evacuated from an enclave on the Syrian-Lebanon border from reaching jihadist territory in eastern Syria. 

The SDF announced the start of the battle for Raqqa on June 6 after a months-long campaign to isolate the city against the north bank of the Euphrates. 

ISIS, then known as Islamic State in Iraq and the Levant, had captured the city in January 2014, seizing it from rebel factions which had ousted the Syrian army a few months earlier. 

As the group became more entrenched in Syria and Iraq leading up to its capture of Mosul in June that year, Raqqa became its most important center, and it celebrated its series of victories with a massive parade through the city. 

Many of its top leaders were at times based there, and former hostages said Mohammed Emwazi, better known as Jihadi John, imprisoned them along with those he later executed, in a building near an oil installation near the city. 

The group killed dozens of captured Syrian soldiers there in July 2014 and it was also the site of a slave market for Yazidi women captured in Iraq and given to fighters. 

The coalition has said Raqqa was a hub for attacks abroad, and in November 2015, after militants killed more than 130 people in Paris, France launched air strikes on ISIS targets inside Raqqa. 

But the group is now in disarray. In Syria it does not only face the U.S.-backed SDF offensive but a rival one by the Syrian army supported by Russia, Iran and allied Shi'ite militias. 

A Syrian military source said on Saturday the army had captured the city of al-Mayadin in the Euphrates valley, leaving Islamic State only a few more towns and villages, and areas of the surrounding desert, in Syria. 

But the battle for Raqqa has come at great cost to its people. Much of the city has been pulverized by the intense coalition air strikes and by the months of street-to-street fighting. Thousands of people have fled as refugees and hundreds of civilians have died.