DOHUK, Iraq — Kurdish forces long allied with the United States in Syria announced a new deal on Sunday with the government in Damascus, a sworn enemy of Washington that is backed by Russia, as Turkish troops moved deeper into their territory and President Trump ordered the withdrawal of the American military from northern Syria.
The sudden shift marked a major turning point in Syria’s long war.
For five years, United States policy relied on collaborating with the Kurdish-led forces both to fight the Islamic State and to limit the influence of Iran and Russia, which support the Syrian government, with a goal of maintaining some leverage over any future settlement of the conflict.
On Sunday, after Mr. Trump abruptly abandoned that approach, American leverage appeared all but gone. That threatened to give President Bashar al-Assad and his Iranian and Russian backers a free hand. It also jeopardized hard-won gains against the Islamic State — and potentially opened the door for its return.
The Kurds’ deal with Damascus paved the way for government forces to return to the country’s northeast for the first time in years to try to repel a Turkish invasion launched after the Trump administration pulled American troops out of the way. The pullout has already unleashed chaos and bloodletting.
The announcement of the deal Sunday evening capped a day of whipsaw developments marked by rapid advances by Turkish-backed forces and the escape of hundreds of women and children linked to the Islamic State from a detention camp. As American troops were redeployed, two American officials said the United States had failed to transfer five dozen “high value” Islamic State detainees out of the country.
Turkish-backed forces advanced so quickly that they seized a key road, complicating the American withdrawal, officials said.
The invasion ordered by President Recep Tayyip Erdogan of Turkey, which came after a green light from President Trump, is aimed at uprooting the Syrian Democratic Forces, a Kurdish-led militia that has been a key partner in the fight against the Islamic State. Turkey sees the group as a security threat because of its links to a Kurdish separatist movement that the country has battled for decades.
The Turkish incursion has killed scores of people, and left Kurdish fighters accusing the United States of betrayal for leaving them at the Turks’ mercy. That is what led them to strike the deal with Damascus, which said on Sunday that its forces were heading north to take control of two towns and to fight the “Turkish aggression.”
Turkey’s invasion upended a fragile peace in northeastern Syria and risks enabling a resurgence of the Islamic State, which no longer controls territory in Syria but still has sleeper cells and supporters.
Since the Turkish incursion began on Wednesday, ISIS has claimed responsibility for at least two attacks in Syria: One car bomb in the northern city of Qamishli and another on an international military base outside Hasaka, a regional capital further to the south.
Mr. Trump has said repeatedly that the United States has taken the worst ISIS detainees out of Syria to ensure they would not escape. But in fact the American military took custody of only two British detainees, half of a cell dubbed the Beatles that tortured and killed Western hostages, American officials said.
As the Turkish incursion progresses and Kurdish casualties mount, members of the Syrian Democratic Forces have grown increasingly angry at the United States. Some have cast Mr. Trump’s move as a betrayal.
The Kurds refused, the American officials said, to let the American military take any more detainees from their ad hoc detention sites for captive ISIS fighters, which range from former schoolhouses to a former Syrian government prison. Together, these facilities hold about 11,000 men, about 9,000 of them Syrians or Iraqis. About 2,000 come from 50 other nations whose governments have refused to repatriate them.
The fighting has raised concerns that jihadists detained in the battle to defeat ISIS could escape, facilitating the reconstitution of the Islamic State. Five captives escaped during a Turkish bombardment on a Kurdish-run prison in Qamishli on Friday, Kurdish officials said.
The Kurdish authorities also operate camps for families displaced by the conflict that hold tens of thousands of people, many of them wives and children of Islamic State fighters.
After a Turkish airstrike, female detainees connected to the Islamic State rioted in a camp in Ain Issa, lighting their tents on fire and tearing down fences, according to a camp administrator, Jalal al-Iyaf.
In the mayhem, more than 500 of them escaped, Mr. al-Iyaf said.
Most of the camp’s other 13,000 residents are Syrian, but there are also refugees from Iraq who sought safety in Syria because of violence at home. By nightfall, some of those people had left the unguarded camp, too, fearing that it was no longer safe, Mr. al-Iyaf said.
“Everyone thought that the camp was internationally protected, but in the end there was nothing,” Mr. al-Iyaf said. “It was not protected at all.”
Determining the exact state of play on the ground proved difficult on Sunday, as the advances by Turkish-backed Arab fighters scattered Kurdish officials who had previously been able to provide information.
The likelihood of an ISIS resurgence remains hard to gauge, since the Syrian Kurdish leadership may have exaggerated some incidents to catch the West’s attention.
The camp escape came hours before the United States military said it would relocate its remaining troops in northern Syria to other areas of the country in the coming weeks.
Defense Secretary Mark T. Esper said in an interview with CBS’s “Face the Nation” that the United States found itself “likely caught between two opposing advancing armies” in northern Syria.
Syrian government troops were expected to enter the city of Kobani overnight.
The Kurdish-led militia said the Syrian government had a “duty to protect the country’s borders and preserve Syrian sovereignty,” and would deploy along the Syrian-Turkish border.
Previously, Trump administration officials argued that keeping Mr. Assad’s forces out of the territory was key to stemming Iranian and Russian influence and keeping pressure on Mr. Assad.
Mr. Trump says his decision to pull American troops out of the way of the Turkish advance was part of his effort to extricate the United States from “endless wars” in the Middle East and elsewhere.
“The Kurds and Turkey have been fighting for many years,” Mr. Trump wrote on Twitter on Sunday.
Mr. Trump also tried to assuage his critics, including Senator Lindsey Graham, the South Carolina Republican who broke with him over the Syria decision and is promising bipartisan legislation to slap economic sanctions on Turkey.
“Dealing with @LindseyGrahamSC and many members of Congress, including Democrats, about imposing powerful Sanctions on Turkey,” Mr. Trump wrote. “Treasury is ready to go, additional legislation may be sought.”
But his decision has had devastating consequences for Syria’s Kurds.
They lost thousands of fighters in battles against the Islamic State and sought to establish a form of autonomous rule in the lands captured from the jihadists. Now that project has collapsed, and it remains unclear what rights they will retain, if any, should they fall back under Mr. Assad’s government.
On Sunday, Turkish troops and their Arab proxies made major progress on the ground, seizing the strategic border town of Tel Abyad and prompting celebrations across the border in Turkey.
In Akcakale, a Turkish border town, residents raced around in cars, flying Turkish flags and honking their horns. Exiled Syrians, many of them from Tel Abyad, climbed onto rooftops to watch the end of the battle as gunfire sounded.
Three wounded Syrian Arab fighters were recuperating in a private apartment near the border in Akcakale after returning from the front line, where they had been shot in an ambush by Kurdish troops.
The men were from an area controlled by Kurdish forces who they said had prevented them from returning home.
“We will not stop,” said Abu Qasr al-Sharqiya, 34, who was shot three times in the leg. “We need our houses back, our children’s homes.”
On Sunday afternoon, Mr. Erdogan announced that his forces controlled nearly 70 square miles of territory in northern Syria.
They have also taken control of an important highway connecting the two flanks of Kurdish-held territory, the Turkish defense ministry said. This allows Turkish troops and their proxies to block supply lines between Kurdish forces — and cut an exit route to Iraq.
It also makes it harder for American troops to leave Syria by road.
Since the Syrian civil war began eight years ago, northern Syria has changed hands several times as rebels, Islamists, extremists and Kurdish factions have vied with the government for control.
After joining American troops to drive out the Islamic State, the Kurdish-led militia emerged as the dominant force across the area, taking control of former ISIS territory and guarding former ISIS fighters on behalf of the United States and other international allies.
With Turkey making increasing noise in recent months about forcing the Kurdish militia away from its border, the American military made contingency plans to get about five dozen of the highest-priority detainees out of Syria.
The planning began last December, when Mr. Trump first announced that he would withdraw troops from the country before his administration slowed down that plan, one official said.
American special forces moved first to get the two British detainees, El Shafee Elsheikh and Alexanda Kotey, on Oct. 9, in part because there was a clear plan for them already in place: The Justice Department wants to bring them to Virginia for prosecution. They are now being held in Iraq.
But as the military then sought to take custody of additional detainees, the Kurds balked, the two American officials said. The Kurds’ animosity might harden now that they have aligned themselves with Mr. Assad, an American foe.
That, combined with the Pentagon’s withdrawal American forces, makes it even less likely the United States will be able to take any more detainees out.
Ben Hubbard reported from Dohuk Iraq, Charlie Savage and Eric Schmitt from Washington and Patrick Kingsley from Istanbul. Carlotta Gall contributed reporting from Akcakale, Turkey, Peter Baker from Washington, Hwaida Saad from Beirut, Lebanon, and Iliana Magra from London.