ANKARA/WASHINGTON (Reuters) - President Donald Trump’s declaration in a phone call with Tayyip Erdogan that he was pulling U.S. troops from Syria has stunned Turkey and left it scrambling to respond to the changing battlefield on its southern border.

In the phone call two weeks ago, Trump had been expected to deliver a standard warning to the Turkish president over his plan to launch a crossborder attack targeting U.S.-backed Kurdish forces in northeast Syria, U.S. officials say.

Instead, in the course of the conversation Trump reshaped U.S. policy in the Middle East, abandoning a quarter of Syrian territory and handing Ankara the job of finishing off Islamic State in Syria.

“Trump asked: ‘If we withdraw our soldiers, can you clean up ISIS?’”, a Turkish official told Reuters. He said Erdogan 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 U.S. 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, U.S. officials said. When Trump made clear he would not back down, Mattis and a senior official coordinating the fight against Islamic State, Brett McGurk, both resigned.

On a visit to a U.S. air base in Iraq this week, Trump said that military commanders had repeatedly requested extensions for the 2,000 U.S. troops in Syria - requests that he finally turned down because he said Islamic State was largely beaten.

“We’ve knocked them silly. I will tell you I’ve had some very good talks with President Erdogan who wants to knock them out also, and he’ll do it,” he told American troops.

FILE PHOTO: Syrian Democratic Forces and U.S. troops are seen during a patrol near Turkish border in Hasakah, Syria November 4, 2018. REUTERS/Rodi Said

RISK FOR TURKEY

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 Islamic State.

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 U.S. withdrawal potentially frees Turkey’s military to push the YPG back from 500 km 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 U.S. support, to protect it from Turkish attack.

And if Turkish forces are to take on Islamic State in its last pocket of Syrian territory near the Iraqi border, they would first have to cross 250 km of territory controlled by the Kurdish-dominated Syrian Democratic Forces.

“Erdogan got more than he bargained for,” said Soner Cagaptay, Director of the Turkish Program at the Washington Institute. “He had asked the U.S. to drop the YPG, but not withdraw from Syria”.

Erdogan 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 U.S. military officials to visit within days, as well as Bolton and possibly the U.S. special Syria envoy, James Jeffrey.

Turkey’s intelligence chief and defense and foreign ministers are also due in Moscow on Saturday, the spokesman for Erdogan’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 U.S. 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 Islamic State ended.

Turkey says the weapons must be collected so they are not used against Turkish troops, but U.S. officials say they cannot disarm their own allies when the fight is not yet over.

Erdogan 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 Islamic State 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 U.S. 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.”