Syria's Kurds said Syrian government forces agreed Sunday to help them fend off Turkey's invasion — a major shift in alliances that came after President Donald Trump ordered all U.S. troops withdrawn from the northern border area amid the rapidly deepening chaos.

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

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

The fast-deteriorating situation was set in motion last week, when Trump ordered U.S. 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 U.S. in defeating the Islamic State in Syria, and 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 over a stretch of 200 kilometers (125 miles). The offensive has displaced at least 130,000 people.

On Sunday, U.S. Defense Secretary Mark Esper said all American troops will 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 said on CBS' "Face the Nation." He did not say how many would withdraw or where they would go but that they represent most of the 1,000 U.S. troops in Syria.

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

Trump, in a tweet, said: "Very smart not to be involved in the intense fighting along the Turkish Border, for a change. 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."