Donald Trump has decided to keep US forces in Syria for a limited period, ending speculation about an immediate pull-out fuelled by the president himself. He agreed at a National Security Council meeting that the 2,000 US troops backed by massive airpower should stay in Syria where they support the Kurds in the east of the country.

“We’re not going to immediately withdraw, but neither is the president willing to back a long-term commitment,” said a senior administration official. He added that Mr Trump wanted to ensure the final defeat of Isis and would like other countries to help stabilise Syria.

The White House said later that its military mission to eradicate Isis in Syria “is coming to a rapid end”.

In recent weeks Mr Trump has been at odds with the Pentagon in promising a swift US withdrawal, just as senior generals were reiterating their commitment to stand by the Syrian Kurdish forces, the People’s Protection Units (YPG). These hold between 25 and 30 per cent of Syria and are the only US ally in the country. Isis has lost almost all its territory but is reverting to guerrilla warfare in parts of eastern Syria. Its fighters have been emboldened by the withdrawal of YPG forces, which have gone to confront the Turkish-led invasion of the Kurdish enclave of Afrin in northern Syria.

The leaders of Turkey, Russia and Iran held a summit in Ankara on Wednesday to try to find common ground on the future of Syria where they all have military forces. Their agendas differ radically, with Russia and Iran supporting President Bashar al-Assad, while Turkey wants him removed from power.

The one big aim uniting Turkish President Recep Tayyip Erdogan, Russian President Vladimir Putin and Iranian President Hassan Rouhani in their approach to the Syrian conflict is that they all want US forces out of Syria, though their motives differ. Mr Putin and Mr Rouhani want Mr Assad’s forces to extend their control to the east and north of the country, while Turkey wants to destroy the Kurdish quasi-state, which the Syrian Kurds call Rojava, which has grown up east of the Euphrates during the war against Isis.

If the limited number of US ground troops were pulled out of Syria, along with – most crucially – the YPG’s ability to call in massive US airstrikes, then the YPG would be unable to stop a Turkish invasion across the long Syrian-Turkish border. The north Syrian plain is flat and could not be defended against Turkish tanks backed by airstrikes.

In a joint statement released at the end of their summit, Mr Putin, Mr Rouhani and Mr Erdogan said they “rejected all attempts to create new realities on the ground under the pretext of combating terrorism”. This is a clear reference to the US. They said they were committed to Syria’s unity, but this is not preventing them intervening by using local proxies and allies. No Syrian parties attended the Ankara summit, the second in a series of three with the next one to be held in Tehran.

Mr Rouhani called on Turkey to hand over Afrin to the Syrian army, something that is unlikely to happen. Russia is eager to cement its new alliance with Turkey, but at the same time is committed to Mr Assad whom it has just helped to retake almost all of Eastern Ghouta on the outskirts of Damascus. It was Russia’s willingness to allow Turkey to use its airforce in Afrin, which had previously been defended by Russian aircraft and anti-aircraft missiles, that opened the door for the Turkish invasion on 20 January and the capture of Afrin city two months later.

The Russian-Turkish-Iranian alliance looks opportunistic and temporary, but it might have a longer life than some commentators expect. Iran badly needs diplomatic allies and commercial partners if Mr Trump effectively withdraws the US from the 2015 Iran nuclear deal on 12 May when he once again has to certify Iranian compliance, something he has said he will not do.

Turkey needs Russian support or neutrality if it is to broaden its intervention against the Kurds in northern Syria. Mr Putin probably gave a green light to the Turkish invasion of Afrin in order to fuel the US-Turkish confrontation, as the US tries to protect its Kurdish allies and Turkey seeks to destroy them.

The three countries meeting in Ankara pledged to stabilise Syria, and this, to some extent, they can do because Isis has been eliminated as a territorial state, though not as a guerrilla force. Isis will be hoping that differences among its enemies will enable it to strengthen itself once again.

Mr Assad will soon control all of Damascus, Aleppo and the most highly populated areas in Syria. He will also draw hope from the fact that, while the Syrian Kurds do not like his government, they prefer it to the prospect of being overrun by the Turkish army and its Sunni Arab auxiliaries.