– Syrian government troops began moving toward towns near the Turkish border Sunday night under a deal struck with Syrian Kurds after a chaotic day that saw the unraveling of the U.S. mission in northeastern Syria.

Hundreds of ISIS family members escaped a detention camp after Turkish shellfire hit the area. U.S. troops pulled out from another base, and Turkish-backed forces consolidated their hold over a vital highway, cutting the main U.S. supply route into Syria.

By the time Defense Secretary Mark Esper appeared on CBS’ “Face the Nation” to announce that President Donald Trump had ordered the final withdrawal of the 1,000 U.S. troops in northeastern Syria, it was already clear that the U.S. presence had become unsustainable, U.S. officials said.

The announcement by the Syrian Democratic Forces (SDF) that they had reached an agreement with the Iranian and Russian-backed government of President Bashar Assad further undermined the prospect of any continued U.S. presence. The deal brings forces loyal to Assad back into towns and cities that have been under Kurdish control for seven years.

“An agreement has been reached with the Syrian government — whose duty it is to protect the country’s borders and preserve Syrian sovereignty — for the Syrian Army to enter and deploy along the Syrian-Turkish border to help the SDF stop this aggression” by Turkey, the SDF said in a statement.

It was unclear where and when the Syrian troops would deploy or whether U.S. forces were already pulling out of areas where they are based. U.S. officials declined to confirm local media reports that troops had pulled out of the towns of Manbij and Kobane, where local officials confirmed they had agreed to allow Syrian troops to deploy.

Witnesses said celebratory gunfire erupted in parts of the town of Qamishli as Syrian troop reinforcements flew into the local airport, according to a Kurdish security official who spoke on the condition of anonymity. He said local Kurdish forces had been ordered not to confront Syrian troops, who arrived to bolster a small contingent of government forces that had remained in the city after Kurdish forces took it over in 2012.

The deal followed three days of negotiations brokered by Russia between the Syrian government and the SDF, which had reached the conclusion that it could no longer count on the United States, its chief ally for the past five years in the fight against ISIS, according to a Kurdish intelligence official who spoke on the condition of anonymity.

Events earlier in the day highlighted the rapid deterioration of both the SDF’s and the United States’ ability to contain swifter-than-expected Turkish advances deep into Syrian territory.

As Turkish-backed Syrian rebels approached the town of Ain Issa, 20 miles from the Turkish border, hundreds of ISIS family members escaped from a camp housing displaced people, taking advantage of the mayhem that ensued as Turkish artillery pounded the area.

The Kurdish administration in northeastern Syria said 785 people affiliated with ISIS escaped from a camp that had housed 12,000 displaced people, mostly women and children.

About a thousand of those, almost all foreigners, had been identified as ISIS supporters and had been housed in a separate section of the camp known as the Annex. That section is now “completely empty,” according to an aid worker who spoke on the condition of anonymity.

The claim that the ISIS-linked families had escaped could not be independently confirmed.

But Kurdish officials and aid groups said thousands of civilians were also leaving, fleeing across fields to escape the shelling. The U.S. military told aid workers to evacuate.

Ain Issa, which served as the headquarters of the Kurdish-led administration in northeastern Syria, owes its significance to its position beside the important M4 highway, which runs from the Iraqi border across northeastern Syria.

It is the main supply route in and out of Syria for the 1,000 U.S. troops deployed there and for much of the limited aid that reaches northeastern Syria.

As the Turkish-backed Syrian rebels closed in on Sunday, the small number of U.S. troops based in the town were relocated to other bases in Syria, said a U.S. official speaking on the condition of anonymity.

Turkish-backed rebels have set up checkpoints on the highway near Ain Issa, cutting off U.S. troops in bases to the west, in the Syrian cities of Manbij and Kobane. Those troops came under Turkish artillery fire Friday night in what some U.S. soldiers suspect was a deliberate attempt to drive them away from the bulk of the U.S. forces farther east, Kurdish and U.S. officials said.

There were conflicting reports from Washington on whether Trump intends to order the withdrawal of all 1,000 of the U.S. troops imminently or simply to relocate those closest to the front lines to safer positions.

But with their supply lines severed, the region in disarray and their Kurdish allies focused on fighting Turkey and not ISIS, the U.S. troop presence in northeastern Syria is becoming increasingly untenable, the U.S. official said.

Residents of northeastern Syria said they were stunned by the speed with which SDF defenses appeared to be collapsing, along with America’s commitment to remain in the area alongside its allies in the five-year fight against ISIS, Kurdish officials said.

It represents a gamble for the Kurds, who appeared to have secured no guarantees for the survival of the autonomy they have secured over the area over the past seven years. Badran Jia Kurd, a senior Kurdish official, said the Kurds felt they had no choice but to turn to Damascus in light of what he called the “betrayal” of the United States. “This has obliged us to look for alternative options,” he said.

A Syrian government announcement that Syrian troops were heading to the area to assume control from the SDF and confront the Turks raised hopes that an end to the chaos was in sight, according to a Kurdish woman who fled her home near the front lines three days ago and has taken refuge in the city of Qamishli.

“For the regime to intervene and deploy its forces on the Turkish border is a comforting thought,” said the woman, who gave her name as Nowruz. “If a deal with the regime is what it takes to stop these massacres, then so be it. At the end of the day, we are all Syrians, and the regime is Syrian, too.”

“The Americans betrayed us. We do not trust them anymore,” she added.

The international aid effort to assist the 130,000 people displaced and those wounded in the fighting is also at risk. The Kurdish administration said all deliveries of food and medical aid have been suspended. There were indications that some agencies have started withdrawing their staffs.

A U.N. official who spoke on the condition of anonymity said half of the aid workers in the areas held by the SDF have evacuated, and others are expected to follow.