In President Donald Trump's phone call two weeks ago with Tayyip Erdoğan, it had been expected that he would deliver a standard warning to the Turkish president over his plan to launch a crossborder attack targeting US-backed Kurdish forces in northeast Syria, US officials say.
Instead, in the course of the conversation Trump reshaped US policy in the Middle East, abandoning a quarter of Syrian territory and handing Ankara the job of finishing off ISIS in Syria.
"Trump asked: 'If we withdraw our soldiers, can you clean up ISIS?,'" a Turkish official told Reuters. He said Erdoğan replied that Turkish forces were up to the task.
"Then you do it," Trump told him abruptly. To his national security adviser John Bolton, also on the call, Trump said: "Start work for the withdrawal of US troops from Syria."
"I have to say it was an unexpected decision. The word 'surprise' is too weak to describe the situation," said the official, one of five Turkish sources who spoke to Reuters about the Dec. 14 call between the two leaders.
Trump's decision was also a shock in Washington, where senior administration officials, including Secretary of Defense Jim Mattis, tried for days to change the president's mind, US officials said. When Trump made clear he would not back down, Mattis and a senior official coordinating the fight against ISIS, Brett McGurk, both resigned.
On a visit to a US air base in Iraq this week, Trump said that military commanders had repeatedly requested extensions for the 2,000 US troops in Syria — requests that he finally turned down because he said ISIS was largely beaten.
"We've knocked them silly. I will tell you I've had some very good talks with President Erdoğan who wants to knock them out also, and he'll do it," he told American troops.
For Turkey, Trump's decision offers opportunity and risk.
Ankara has complained bitterly for years that the United States, a NATO ally, had chosen the Kurdish YPG militia as its main partner on the ground in Syria against ISIS.
Turkey says the YPG is a terrorist group, inseparable from the Kurdistan Workers Party (PKK) which has waged an insurgency in southeast Turkey in which 40,000 people have been killed.
The US withdrawal potentially frees Turkey's military to push the YPG back from about 310 miles of border without risking a confrontation with American forces. It also removes a main cause of this year's diplomatic crisis between the two countries.
But it also opens up an area of Syria far larger than anything Turkey had expected to fill, potentially pitting it against not just Kurdish forces but also the Damascus government — which is committed to regaining control of all of Syria — and its Russian and Iranian backers.
The YPG on Friday asked the Syrian government to take over the town of Manbij, which the Kurdish militia currently controls with US support, to protect it from Turkish attack.
And if Turkish forces are to take on ISIS in its last pocket of Syrian territory near the Iraqi border, they would first have to cross about 155 miles of territory controlled by the Kurdish-dominated Syrian Democratic Forces.
"Erdoğan got more than he bargained for," said Soner Cagaptay, director of the Turkish Program at the Washington Institute. "He had asked the US to drop the YPG, but not withdraw from Syria."
Erdoğan has for years backed rebels who once hoped to topple Bashar al-Assad, but the Syrian president's survival has been assured by support from Tehran and Moscow even though the north and east — including Syrian oilfields — remain beyond Assad's control for now.
As it takes stock of the new challenge, Turkey is launching intensive talks with Washington and Moscow. Ankara expects US military officials to visit within days, as well as Bolton and possibly the US special Syria envoy, James Jeffrey.
Turkey's intelligence chief and defense and foreign ministers are also due in Moscow on Saturday, the spokesman for Erdoğan's AK Party said.
"Of course it will be difficult. The whole issue needs to be planned again from the start," a Turkish security official said.
A US official said military planners were drafting plans that could see a withdrawal over the course of several months. One of the proposals under consideration is a 120-day withdrawal period, according a person familiar with discussions.
Washington is also grappling with what to do with weapons it provided to the YPG militia and promised to take back after the campaign against ISIS ended.
Turkey says the weapons must be collected so they are not used against Turkish troops, but US officials say they cannot disarm their own allies when the fight is not yet over.
Erdoğan announced last week Turkey is postponing its planned military operation against the YPG in light of Trump's decision.
The Turkish military has already carried out two incursions into north Syria, backed by pro-Turkey Syrian rebels. In 2016 they targeted ISIS and Kurdish fighters, and earlier this year took control of the YPG-held Afrin region.
But Ankara and its Syrian rebel allies alone do not have the capacity to take over the whole region which the United States is abandoning, Cagaptay said. Turkey's priority therefore may be to secure its southern frontier.
"Distancing the YPG from the border and wiping out these elements is of critical importance," the security official said.
He stressed the need for careful coordination over who should fill other areas which departing US forces will leave, and warned of problems ahead if agreement could not be reached.
"Is it a big victory for Turkey?" another official said. "I'm not sure right now."
By Orhan Coskun and Lesley Wroughton/Reuters
Additional reporting by Tulay Karadeniz in Ankara and Humeyra Pamuk and Idrees Ali in Washington; Editing by Dominic Evans and Angus MacSwan.
Sign up for The Top of the World, delivered to your inbox every weekday morning.