“I know that the entire world is watching us”, declared Turkish President Recep Tayyip Erdogan at the start of his talks with Russian President Vladimir Putin in Moscow yesterday designed to end a standoff between the two countries over the last rebel-held enclave in north-western Syria, Idlib. Erdogan may have been over-egging the pudding, but only just.

The Syrian war, which has entered its endgame after nine hellish years, has destroyed the country. The United Nations estimates that a quarter of the pre-war population of 22 million people are now refugees, with another quarter internally displaced.

But even in this context, the crisis in Idlib dwarfs all that came before it. As Syrian troops, backed by Russia, have moved to clear the province over recent months, some 900,000 civilian refugees have been pushed against the Turkish border. Tukey has sought to resist the offensive, but it has been costly. More than 60 Turkish soldiers have been killed since the start of February, including 36 in an airstrike last week which Ankara blames on Syrian government forces.

Turkey responded to that airstrike with a barrage of drone strikes and artillery that dealt Assad’s regime its worst blow in years. Long accustomed to fighting ill-equipped rebels, Syrian forces are now battling the second-largest army in NATO.

Russia and Turkey have struck two previous deals over Syria, one over Idlib in September 2018 and another over the Turkish-Syrian border in October 2019, only for their agreements to fall apart on the battlefield. Both countries blame the other for first violating the arrangements which established a de-escalation zone in Idlib province. There’s no reason to suspect that yesterday’s agreement – which establishes a new ceasefire – won’t go the same way.

Geir Pedersen, the United Nations Special Envoy for Syria, recently described the scale of humanitarian suffering in Idlib as “devastating”. But with the United States showing little appetite for any involvement in Middle Eastern conflicts, and the European Union effectively side-lined, Russia has long been calling the shots in Syria.

Over recent months Russian and Syrian aircraft have carried out dozens of strikes daily, including against hospitals. Intercepted Russian Air Force communications – from last year – confirm that both countries have intentionally targeted civilian areas. These tactics are not new, but have characterised Russia’s operations since it inserted itself in the war in 2015. Estimates suggest that Russia has killed more civilians in Syria than the Islamic State.

The standoff over Idlib has tested the fragile alliance that has allowed Russia and Turkey to work together in the Middle East. Both want to contain the war, and would like to establish Idlib as a buffer zone between Turkey and Assad-controlled Syria. Erdogan is motivated by growing domestic pressures to deliver success in Syria, while Putin seeks to cement Russia’s regional influence by keeping Assad in power. Assad, however, wants to reclaim all of his former territory.

But there is a longer-term strategy for Russia, and it took shape after the 2016 coup attempt in Turkey. Putin swiftly and publicly backed Erdogan, who at the same time accused the West of siding with Fethullah Gülen, the US-based businessman and cleric whom Anakara says was behind the putsch. Having seen how the Kremlin bolstered the regimes of Assad and Venezuela’s Nicolas Maduro, Erdogan saw value in strengthening ties with Putin.

Russia is now Turkey’s second-biggest trading partner, and Turkey is the third-largest market for Russian gas supplies. Russia is in the midst of building Turkey’s first nuclear plant, and last year Turkey purchased Russia’s S-400 surface-to-air defence system, antagonising the United States and other Western allies in the process. Russia’s aim is to reorient Turkey’s foreign policy away from the West and to weaken NATO.

After last week’s airstrike, Ankara sought help from NATO by demanding an emergency meeting of the organisation’s ambassadors. Speaking after the meeting, NATO Secretary General Jens Stoltenberg had no choice other than to say that the alliance stood in “solidarity with Turkey”. Yet the way in which Turkey has pursued closer relations with Russia while being a member of NATO weakens the alliance’s credibility. The one person who knows this best is Vladimir Putin.

Dr Andrew Foxall is Director of the Russia and Eurasia Studies Centre at the Henry Jackson Society, the international affairs think tank.