In this Aug. 28, 2019, file photo, Secretary of Defense Mark Esper speaks to reporters during a briefing at the Pentagon. Esper says the "impulsive" decision by Turkey to invade northern Syria will further destabilize a region already caught up in civil war. Esper says the invasion puts America's Syrian Kurdish partners "in harm's way," but insists the Kurds are not being abandoned.

BEIRUT — 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 Islamic State 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's "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 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 in the country. 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 out of safety concerns. 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 the Islamic State, according to a Kurdish intelligence official who spoke on the condition of anonymity because he is not authorized to speak to the news media.

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 Islamic State 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 the Islamic State 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 Islamic State 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 because the person was not authorized to speak to the news media.

The claim that the Islamic State-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 because he was not authorized to talk to the news media.

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 the Islamic State, 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 the Islamic State, 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 United Nations official who spoke on the condition of anonymity to discuss sensitive issues said half of the aid workers in the areas held by the SDF have evacuated, and others are expected to follow.

A Turkish airstrike against a convoy of vehicles carrying civilians and journalists killed at least nine people, illustrating the dangers confronting those who remain in the area, according to the Syrian Observatory for Human Rights, a monitoring group.

The convoy was approaching the town of Ras al-Ayn, one of the first two border towns targeted by the Turkish invasion, when a warplane struck. Videos of the aftermath showed limbs and body parts scattered across a wide area and horrific injuries suffered by some of the survivors.

Ain Issa is the third town from which U.S. troops have withdrawn since Trump announced that the United States would not stand in the way of a Turkish invasion of northeastern Syria aimed at pushing U.S.-allied Kurdish-led forces away from the Turkish border. About 50 troops withdrew Monday from the border towns of Tal Abyad and Ras al-Ayn, which were the first targets of the Turkish advance.

Turkey regards the Syrian Kurdish fighters that lead the SDF as a terrorist organization because of their affiliation with the Kurdistan Workers' Party, which has been waging an insurgency against the Turkish government for decades. But Turkey's offensive has drawn almost no international support, leaving the country isolated as it presses ahead with the campaign.

President Recep Tayyip Erdogan, speaking in Istanbul on Sunday, rejected foreign criticism of the Turkish offensive, as well as calls from Britain and other countries to negotiate with the Syrian Kurds to end the conflict.

"How can you recommend sitting down at the same table with terrorists?" he asked.

He said the operation would continue until the Kurdish-led force is driven back from Turkey's borders.

"We are not fighting against the Kurds," Erdogan said. "We are not targeting Kurdish citizens."

He gave no indication that the operation would end soon. Turkish forces would press 19 miles into Syria, he said, and "until they leave the space, we will continue the operation."

"We will not let a terrorist state be established in northeastern Syria."

Loveluck reported from Irbil, Iraq. Asser Khattab in Beirut and The Washington Post’s Kareem Fahim in Istanbul contributed to this report.