As the prospect grows of military confrontation with Russia in the skies over Syria, the US is counting on support from European partners such as France and the UK. But help from a key regional ally – Turkey – is less certain, despite its position on Syria’s northern border and opposition to Bashar al-Assad’s regime.

There are echoes of 2003, when Turkey refused to back the US-led invasion of Iraq. Whose side Turkey is on is a question increasingly exercising Washington policymakers as Recep Tayyip Erdoğan, Turkey’s president, builds closer ties with Russia.

Although Turkey is a Nato member, its growing defence cooperation with Moscow includes a recent $2bn deal to buy state-of-the-art S-400 surface-to-air missile systems. At the same time, military collaboration with the US has been scaled back.

Faced with Turkish restrictions, US air force combat operations at the Incirlik base, close to Syria’s border, have been run down. In January a squadron of A-10 “Warthog” ground-attack jets was redeployed to Afghanistan, reportedly leaving only refuelling aircraft at the base. Last year Germany, another Nato member, was obliged to withdraw its forces from Incirlik amid a fierce row with Erdoğan over human rights and legal issues. The German aircraft, which like their American counterparts were engaged in attacking Islamic State forces in Syria and Iraq, were moved to Jordan.

US-Turkey tensions rose after the failed 2016 coup attempt in Ankara, which Erdoğan claimed was instigated by opponents based in the US. They have since been exacerbated by rows over Turkish human rights abuses, Washington’s support for anti-Assad Syrian Kurdish forces, whom Turkey regards as terrorists, and by Turkey’s military incursion into Afrin, in north-west Syria.

Erdoğan’s government, which has previously demanded Assad step down, initially blamed the Syrian regime for last Saturday’s chemical weapons attack in Douma – the focus of current tensions between Russia and the west. “The Syrian regime will have to pay the price,” İbrahim Kalin, Erdoğan’s spokesman, said on Monday.

The government spokesman Bekir Bozdağ said the Assad regime was guilty of “barbarity and [a] crime against humanity”. But Ankara changed its tune after Erdoğan received a phone call later that day from Assad’s main backer, the Russian president, Vladimir Putin. Ensuing official statements pointedly avoided blaming Douma on the regime, calling instead for a “careful investigation” – Putin’s exact position.

A menacing statement by Sergei Lavrov, Russia’s foreign minister, may also have changed Turkish minds. Russia has hitherto acquiesced in Turkey’s Afrin operation, obtaining assurances from Damascus that regime forces would not oppose it. But on Monday Lavrov said Moscow expected Turkey to hand over Afrin to Assad. Iran, Russia’s collaborator in Syria, made a similar call. Erdoğan angrily rejected the demands, but the message from Moscow was crystal clear: don’t mess with us.

Turkey’s close collaboration with Russia – critics would call it subservience – is a relatively recent phenomenon. The two countries came to blows in November, 2015 when Turkey shot down a Russian military jet for alleged airspace violations. Moscow retaliated by imposing economic sanctions.

To the dismay of Nato and the EU, the subsequent rapprochement has been rapid, fuelled by shared self-interest, especially in Syria. Both Erdoğan and Putin want to shape any post-war settlement to their advantage. To this end they launched, with Iran, the so-called Astana peace process, rivalling talks overseen by the UN.

Putin personally commiserated with Erdoğan after the 2016 coup attempt, assuring him of Moscow’s full support. That was an important moment for two instinctive autocrats who fear the popular verdict of the street. Since then, bilateral cooperation on nuclear power, energy pipelines from Russia to Turkey and Europe, tourism, investment, arms sales and military-to-military ties have reached “unprecedented levels”, according to the IISS thinktank.

Erdoğan and Putin share another aim: curbing US influence in the Middle East. And for Russia, courting Turkey brings additional benefits – sowing discord within Nato and limiting US military options in Syria when, as now, push may come to shove.