Turkey has agreed to suspend its Syria offensive for five days and will end the assault if Kurdish-led forces withdraw from a safe zone along the border, US Vice President Mike Pence and Turkish officials announced on Thursday after high-stakes talks.
The agreement for the 120-hour pause eased what had escalated into an unprecedented crisis between the United States and Turkey, but critics quickly accused President Donald Trump of again abandoning Kurdish allies.
Under the deal reached after Pence flew to Ankara, Kurdish forces will have to withdraw from an area 32km deep, becoming a "safe zone" long sought by Turkey, which brands the fighters as "terrorists".
Trump paved the way for the week-long Turkish incursion by withdrawing US troops but he later imposed sanctions and threatened to destroy the NATO ally's economy as he came under fire at home.
After talks with President Recep Tayyip Erdogan that stretched hours longer than expected, Pence told reporters that Turkey's operation "will be halted entirely on completion" of the pullout of the Syrian Democratic Forces (SDF) and, following that, the US would withdraw sanctions.
Pence said the United States would work with the PG, the Kurdish fighters who dominate the SDF, "to facilitate an orderly withdrawal in the next 120 hours".
SDF chief Mazlum Abdi said the forces were "ready to abide by the ceasefire" covering the area from Ras al-Ain to Tal Abyad.
But James Jeffrey, the US pointman on Syria, acknowledged that the Kurdish fighters were not happy and that Washington was using "a carrot and a stick" with threats of sanctions to enforce the deal.
"There's no doubt that the YPG wishes that they could stay in these areas," he told reporters travelling from Ankara with Secretary of State Mike Pompeo.
The Syrian Observatory for Human Rights war monitor said more than 300 000 civilians had been displaced within Syria since the start of the assault, calling it one of the largest upheavals since Syria's civil war began in 2011.
The monitor said nearly 500 people have been killed including dozens of civilians, the majority on the Kurdish side.
Turkey has faced wide condemnation, with many European countries imposing arms embargoes. EU leaders meeting in Brussels reiterated their call early on Friday for Turkey to end its assault, while noting the pause in the offensive.
Turkish Foreign Minister Mevlut Cavusoglu insisted to journalists in Ankara that Turkey was "suspending the operation, not halting it".
"This is not a ceasefire. A ceasefire is reached between the two legitimate parties."
Ankara considers YPG militants to be an extension the outlawed Kurdistan Workers' Party (PKK) - a group that has fought a bloody insurgency inside Turkey for 35 years.
Trump hailed the deal, reached after more than four hours of talks led by Pence, as "a great day for civilisation".
"I want to thank the Kurds, because they were incredibly happy with this solution," he said during a visit to Texas. "This is a solution that really - well it saved their lives, frankly."
A day after the leak of a letter in which Trump warned Erdogan not to be a "fool", Trump hailed the Turkish president as "a friend of mine", adding: "He's a hell of a leader."
Erdogan on Twitter called for action to "defeat terrorism", saying "I am confident this joint effort will promote peace and stability in our region".
Erdogan, who like Trump has faced political setbacks at home, found wide domestic support for the operation.
But Trump faced accusations even from usual supporters that his withdrawal of 1 000 US troops - practically the entire US contingent in the region - betrayed Kurdish militants who bore the brunt of the fight against the Islamic State group in recent years.
Trump quickly faced renewed attacks over the deal.
"President Trump's decision to help Turkey push the Kurds out of their home in northern Syria after all they have done to help the US defeat ISIS is outrageous," said Senator Tim Kaine, a Democrat.
Erdogan wants to destroy Kurdish hopes of an autonomous enclave that Turkey fears could serve as a launchpad for attacks on its soil.
He also wants to resettle some of the 3.6 million Syrian refugees Ankara is hosting.
Jeffrey said Turkey had promised that its presence in the zone would be short, insisting that the United States still recognised Syria's territorial integrity.
"The Turks have reassured us many times that they have no intention - no intention whatsoever, from President Erdogan personally on down today - of staying in Syria very long," he said.
The US pullout has strengthened both Syrian President Bashar al-Assad, who for the first time sent troops to the northeast in an agreement with Kurdish forces, and Russia - Assad's main backer.
Erdogan will meet his Russian counterpart Vladimir Putin on Tuesday - when the five-day period will come to an end - in the Black Sea resort of Sochi as both sides seek to prevent a war between Turkey and Syria.