Donald Trump’s decision to give the green light – now seemingly turning amber – for Turkey to enter northern Syria has produced a torrent of criticism from European capitals to Washington Republicans, all pointing out that Ankara’s move will revive Islamic State, cause untold civilian deaths and land the US with an indelible reputation across the Middle East as an unreliable ally.

But the west has been losing traction in Syria over the past two years, and it may be the reaction of Russia and Iran, who have forces on the ground in Syria, that will most concern the Turkish president, Recep Tayyip Erdoğan. Their reaction may also reveal more about the long-term future of Syria’s eight-year civil war.

So far both Tehran and Moscow have urged Erdoğan to show restraint, but they will also see opportunities amid the chaos created by Trump’s impulsiveness.

At its simplest, the Russian president, Vladmir Putin, who is seeking to embed Russia’s influence across the Middle East, will see a chance to exploit what is viewed as Trump’s betrayal of the Kurds, the US’s bloodied battering ram in the fight against Isis. The lesson is clear: when the crunch comes, the US will not have your back, Putin will argue. Riyadh, take note.

But Putin also wants to see an end to the Syrian civil war. With the US leaving the scene, he may try to forge his own “deal of the century” between Erdoğan, the Syrian regime and the Kurds.

Quick Guide What is happening in north-eastern Syria? Show Who is in control in north-eastern Syria? Until Turkey launched its offensive there on 9 October, the region was controlled by the Syrian Democratic Forces (SDF), which comprises militia groups representing a range of ethnicities, though its backbone is Kurdish. Since the Turkish incursion, the SDF has lost much of its territory and appears to be losing its grip on key cities. On 13 October, Kurdish leaders agreed to allow Syrian regime forces to enter some cities to protect them from being captured by Turkey and its allies. The deal effectively hands over control of huge swathes of the region to Damascus. That leaves north-eastern Syria divided between Syrian regime forces, Syrian opposition militia and their Turkish allies, and areas still held by the SDF – for now. On 17 October Turkish president, Recep Tayyip Erdoğan, agreed with US vice-president Mike Pence, to suspend Ankara’s operation for five days in order to allow Kurdish troops to withdraw. The following week, on 22 October, Erdoğan and his Russian counterpart, Vladimir Putin agreed on the parameters of the proposed Turkish “safe zone” in Syria. How did the SDF come to control the region? Before the SDF was formed in 2015, the Kurds had created their own militias who mobilised during the Syrian civil war to defend Kurdish cities and villages and carve out what they hoped would eventually at least become a semi-autonomous province. In late 2014, the Kurds were struggling to fend off an Islamic State siege of Kobane, a major city under their control. With US support, including arms and airstrikes, the Kurds managed to beat back Isis and went on to win a string of victories against the radical militant group. Along the way the fighters absorbed non-Kurdish groups, changed their name to the SDF and grew to include 60,000 soldiers. Why does Turkey oppose the Kurds? For years, Turkey has watched the growing ties between the US and SDF with alarm. Significant numbers of the Kurds in the SDF were also members of the People’s Protection Units (YPG), an offshoot of the Kurdistan Workers’ party (PKK) that has fought an insurgency against the Turkish state for more than 35 years in which as many as 40,000 people have died. The PKK initially called for independence and now demands greater autonomy for Kurds inside Turkey. Turkey claims the PKK has continued to wage war on the Turkish state, even as it has assisted in the fight against Isis. The PKK is listed as a terrorist group by Turkey, the US, the UK, Nato and others and this has proved awkward for the US and its allies, who have chosen to downplay the SDF’s links to the PKK, preferring to focus on their shared objective of defeating Isis. What are Turkey’s objectives on its southern border? Turkey aims firstly to push the SDF away from its border, creating a 20-mile (32km) buffer zone that would have been jointly patrolled by Turkish and US troops until Trump’s recent announcement that American soldiers would withdraw from the region. Erdoğan has also said he would seek to relocate more than 1 million Syrian refugees in this “safe zone”, both removing them from his country (where their presence has started to create a backlash) and complicating the demographic mix in what he fears could become an autonomous Kurdish state on his border. How would a Turkish incursion impact on Isis? Nearly 11,000 Isis fighters, including almost 2,000 foreigners, and tens of thousands of their wives and children, are being held in detention camps and hastily fortified prisons across north-eastern Syria. SDF leaders have warned they cannot guarantee the security of these prisoners if they are forced to redeploy their forces to the frontlines of a war against Turkey. They also fear Isis could use the chaos of war to mount attacks to free their fighters or reclaim territory.

On 11 October, it was reported that at least five detained Isis fighters had escaped a prison in the region. Two days later, 750 foreign women affiliated to Isis and their children managed to break out of a secure annex in the Ain Issa camp for displaced people, according to SDF officials. It is unclear which detention sites the SDF still controls and the status of the prisoners inside. Michael Safi

Ever since the dispatch of Russian troops into Syria to shore up President Bashar al-Assad in 2015, Moscow has been slowly wresting the political process away from the west. It has, for instance, forced UN envoys to come to terms with the Astana process, a proposal for Syria’s future initiated by Putin as a rival to the UN and, in effect, a spoiler while Russia and Assad made steady military progress against the opposition forces.

But the Astana process – involving Iran, Turkey and Russia – has haltingly led to the establishment of a now UN-backed Syrian constitutional committee, an idea first proposed by Putin in January 2018. The aim is to write a new constitution for Syria and prepare for elections.

The UN envoy Geir Pederson formally announced the committee on 23 September, claiming it to be the “first concrete political agreement” between the government and opposition groups, which “implies a clear acceptance of the other as an interlocutor”.

The committee is composed of 150 members, split evenly between Assad’s government, the opposition and Syrian civil society. Hadi al-Bahra will lead for the opposition. The group is due to hold its first session at the UN headquarters in Geneva on 30 October.

This process could yet collapse. Individual Kurdish representatives linked to the opposition are part of this committee, but the political representatives of the Syrian Kurdish fighting forces, the YPG, have been left out, an exclusion that has led to protests outside UN offices in Syria’s northern city of Qamishli.

Assad said he was not prepared to see what he regards as separatists from the Kurdistan Workers party (PKK) – linked to the YPG – involved in the talks since he regarded them as a threat to Syria’s territorial integrity.

But the constitution committee is Putin’s brainchild and he will not wish to see it threatened by fighting in north-east Syria. Instead he will see if the Turkish invasion is a chance to engineer an unlikely reconciliation between the Kurds and the Syrian regime.

Some Syrian Kurds, watching the accumulating signs that Trump would leave them in the lurch, have argued that their future security lies in coming to some form of reconciliation with Damascus based on a federal Syria. The commander of the mainly Kurdish Syrian Democratic Forces, Mazlum Kobane, said in the past week: “We are considering a partnership with Syrian president Bashar al-Assad, with the aim of fighting Turkish forces.”

So far Putin has said little as he seeks to square many circles. He phoned Erdoğan to urge him to “consider carefully the situation so as not to damage the overall efforts to resolve the Syrian crisis”.

At the same time, Putin will not wish to offend Erdoğan, or suggest Turkish concerns about Kurdish terrorism inside Turkey, stemming from the Syrian border, are unfounded. He has been trying to woo Turkey away from the Nato orbit and has succeeded in persuading Erdoğan to buy a Russian air defence system.

Putin’s specific proposal, backed by the Iranian president, Hassan Rouhani, is to revive the Adana agreement signed by Syria and Turkey in 1998. It is an idea he has been pushing for three years. In essence, this acknowledges that Turkey has legitimate concerns about the PKK, but the solution is not a Turkish-administered safe zone inside Syria, rather it rests on security guarantees from the Syrian government to control the PKK. Similarly, the way to handle the Syrian refugees inside Turkey is not to forcibly move them into north-east Syria, only to meet a hostile reception, but to end the civil war.

But at the heart of the conundrum is an agreement between the Kurds, Assad and the Turks. If Putin can pull it off, it will indeed be the deal of the century. If he cannot, he may end up in agreement with Trump that the Middle East brings nothing but “sand and death”.