Trump's shock decision to withdraw troops from Syria has prompted Turkey to launch an offensive against northern Syria - a move that could see the return of ISIS.

The Syrian Government has agreed to help the under-siege Kurds fend off Turkey’s invasion, in a major shift of alliances after President Donald Trump ordered all US troops to withdraw from the country.

The shift could lead to clashes between Turkey and Syria and a resurgent Islamic State as the US relinquishes any remaining influence in northern Syria to President Bashar Assad and his chief backer, Russia.

.....The Kurds and Turkey have been fighting for many years. Turkey considers the PKK the worst terrorists of all. Others may want to come in and fight for one side or the other. Let them! We are monitoring the situation closely. Endless Wars! — Donald J. Trump (@realDonaldTrump) October 13, 2019

Adding to the turmoil on Sunday, hundreds of Islamic State families and supporters escaped from a holding camp in Syria amid fighting between Turkish forces and the Kurds.

The fast-deteriorating situation was set in motion last week when Mr Trump ordered US troops in northern Syria to step aside, clearing the way for an attack by Turkey, which regards the Kurds as terrorists.

Since 2014, the Kurds have fought alongside the US in defeating IS in Syria, and Mr Trump’s move was decried at home and abroad as a betrayal of an ally.

Over the past five days, Turkish troops and their allies have pushed their way into northern towns and villages, clashing with the Kurdish fighters across 200km. The offensive has displaced at least 130,000 people.

On Sunday, US defence secretary Mark Esper said all American troops would withdraw from northern Syria because of the increasing danger of getting caught in the crossfire.

“We have American forces likely caught between two opposing advancing armies, and it’s a very untenable situation,” he told Face the Nation. He did not say how many would withdraw or where they would go but that they represented most of the 1000 US troops in Syria.

The peril to American forces was illustrated on Friday, when a small number of US troops came under Turkish artillery fire at an observation post in the north. No Americans were hurt. Mr Esper said it was unclear whether that was an accident.

RELATED: Turkish-backed killer militia exposed

“Very smart not to be involved in the intense fighting along the Turkish Border, for a change,” Mr Trump said in a tweet.

“Those that mistakenly got us into the Middle East Wars are still pushing to fight. They have no idea what a bad decision they have made.”

Kurdish officials announced on Sunday that they would work with the Syrian Government to fend off the Turkish invasion, deploying side by side along the border.

Syrian TV said government troops were moving to the north to confront the Turkish invasion but gave no details.

The Kurdish fighters had few options after the United States abandoned them, and it had been anticipated they would turn to Assad’s government for support.

A return by Assad’s forces to the region where Syrian Kurds have built up autonomy in the north would be a major shift in Syria’s long-running civil war, further cementing Assad’s hold over the ravaged country.

It would also mean US troops no longer had a presence in an area where Russia and Iranian-backed militias now have a role.

It was not clear what Russia’s role was in cementing the agreement. But Russian officials have been mediating low-level talks between the Kurds and Damascus. Syria is allied with Russia. Turkey, though it is a NATO member, has drawn close to Moscow in recent years under Turkish President Recep Tayyip Erdogan. The US withdrawal leaves open the question of what happens to the Kurdish-run prisons and detention centres that hold thousands of IS prisoners, including more than 2000 foreign militants.

On Sunday, heavy fighting reached a Kurdish-run displaced-persons camp in Ein Eissa, about 35km south of the border, which is home to about 12,000 people, including about 1000 wives and widows of IS fighters and their children.

The Kurdish-led administration in northern Syria said in a statement that 785 IS supporters escaped after attacking guards and storming the gates. It was not immediately possible to confirm that figure.

“It gets worse by the hour,” Mr Esper said of the fighting. “These are all the exact things” US officials warned Mr Erdogan would probably happen in urging him not to invade.

Mr Erdogan on Sunday ruled out any mediation in the dispute with the Kurds, saying Turkey wouldn’t negotiate with “terrorists”. Turkey’s official Anadolu news agency said Turkey-backed Syrian forces had advanced into the centre of a Syrian border town, Tal Abyad, on the fifth day of Turkey’s offensive.

Turkey’s Defence Ministry tweeted its forces had taken control of the main highway running between Hassakeh, a major town and logistics hub, and Ein Eissa, the administrative centre of the Kurdish-held areas. Casualties mounted.

On Sunday, at least nine people, including five civilians, were killed in Turkish air strikes on a convoy in the Syrian border town of Ras al-Ayn, according to the Syrian Observatory for Human Rights and Syrian Kurdish officials.

Images of the attack showed bodies and severed limbs strewn in the street. Some of those killed appeared to be carrying guns. Activists said the gunmen were guarding the convoy.

Turkey said 440 Kurdish fighters had been killed since the operation began on Wednesday. The SDF said 56 of its fighters have died. Turkey also said four of its soldiers were killed, along with 16 allied Syrian fighters.