Turkey’s president announced his country had won US approval to establish a 30-kilometre “safe zone” in Syria along its border to keep groups it regards as terrorists away from its frontier, a plan that could put Ankara into armed conflict with America’s Kurdish partners.

“A safe zone that will be created in Syria by us alongside the Turkish border,” President Recep Tayyip Erdogan said in a speech before parliament, saying he had won American co-operation for the deal during a 14 January phone call with US president Donald Trump.

Mr Trump in a tweet on Sunday threatened to “devastate Turkey economically” if it struck Kurdish militias that had fought alongside US forces in the four-year battle against Isis in Syria, but also called vaguely for a 20-mile safe zone.

The cities of Qamishli and Kobani and several other key population centres controlled by Syrian Kurdish forces lie within 20 miles of the Turkish border, and it remains unclear how the US or Turkey would convince them to vacate territories they won from Isis and the Damascus regime of Bashar al-Assad and want as part of their autonomous Kurdish homeland in Syria.

The US president’s tweets prompted angry responses from senior Turkish officials. But Mr Trump and Mr Erdogan were apparently friendly during a phone call the following day.

“Some messages given from Mr Trump’s social media account have upset me and my friends,” Mr Erdogan said on Tuesday.

“We immediately acted and we discussed those issues with him on the phone again last night. It was a quite positive conversation.”

The two leaders “exchanged views on the creation of a terror-free safe zone in northern Syria on the basis of Syria’s territorial integrity”, said a Turkish readout of the conversation provided to international journalists.

Lebanon storm hits Syrian refugee camps – in pictures Show all 15 1 /15 Lebanon storm hits Syrian refugee camps – in pictures Lebanon storm hits Syrian refugee camps – in pictures Khaled Alawi stands with his daughters in front of his home in an informal settlement for Syrian refugees in Akkar, northern Lebanon Richard Hall/The Independent Lebanon storm hits Syrian refugee camps – in pictures A Syrian refugee child looks from his makeshift shelter at Qab Elias Syrian refugee camp in the Bekaa valley EPA Lebanon storm hits Syrian refugee camps – in pictures Children play in front of a shelter in Akkar Richard Hall/The Independent Lebanon storm hits Syrian refugee camps – in pictures Syrian refugees Jose Ahmad al-Jessi, a mother of eight in her 50s, and her daughter Raghad, stand in the doorway of a shop warehouse, where they fled to when their tent flooded on Tuesday Richard Hall/The Independent Lebanon storm hits Syrian refugee camps – in pictures Khaled Alawi surveys the damage to his shelter in Akkar Richard Hall/The Independent Lebanon storm hits Syrian refugee camps – in pictures Syrian refugees sit inside their makeshift shelter in the Bekaa valley EPA Lebanon storm hits Syrian refugee camps – in pictures A young boy stands in front of his shelter in Akkar Richard Hall/The Independent Lebanon storm hits Syrian refugee camps – in pictures A Syrian refugee child plays with snow outside their makeshift shelter in the Bekaa valley EPA Lebanon storm hits Syrian refugee camps – in pictures Richard Hall Richard Hall/The Independent Lebanon storm hits Syrian refugee camps – in pictures A Syrian refugee shovels mud in front of a makeshift shelter follwoing rain storms in the Bekaa valley AFP/Getty Images Lebanon storm hits Syrian refugee camps – in pictures A shelter in Akkar Richard Hall/The Independent Lebanon storm hits Syrian refugee camps – in pictures Syrian refugee children play with snow outside their makeshift shelter in the Bekaa valley EPA Lebanon storm hits Syrian refugee camps – in pictures A Syrian refugee family pumps water after heavy rain in the Bekaa Valley AP Lebanon storm hits Syrian refugee camps – in pictures Syrian refugee children play outside their family tents after a heavy rain at a refugee camp in the town of Bar Elias, in Lebanon's Bekaa Valley AP Lebanon storm hits Syrian refugee camps – in pictures A flooded road leads to an informal settlement for Syrian refugees in Akkar Richard Hall/The Independent

Following a 14 December phone call with Mr Erdogan, Mr Trump stunned Washington, the world and close US allies, including the UK and France, by declaring a withdrawal of 2,200 or so American troops and hundreds of private contractors from northeastern Syria.

But his aides, including the hawkish national security adviser John Bolton, have been trying to add conditions to the US withdrawal, including safety for the People’s Protection Units, or YPG, a Syrian Kurdish armed force loyal to Abdullah Ocalan, founder of the Kurdistan Workers Party, or PKK, that Ankara, Washington and the EU consider a terrorist group.

Erik Prince suggests private army to replace US troops in Syria

According to the Turkish readout of Monday’s phone conversation, Mr Trump and Mr Erdogan agreed “to deny opportunities to all elements that seek to stop the withdrawal decision from being implemented”.

Turkish officials were uncharacteristically understated in response to Mr Trump’s bellicose threat against their economy, perhaps growing immune to the US president’s Twitter eruptions.

“The phone diplomacy between Erdogan and Trump seems to have softened the air,” journalist Murat Takan wrote on Twitter. “Trump is like a bull in a china shop. Because Erdogan is aware of this, he immediately activated phone diplomacy.”