The marriage of convenience between Vladimir Putin and Recep Tayyip Erdogan has confounded sceptics by withstanding Russian and Turkish rivalries in Syria and Libya.
Now, with the deadliest fighting in decades returning to Azerbaijan's Armenian separatist region of Nagorno Karabakh, the bond between the two strong-willed leaders is being tested in Russia's own backyard, analysts said.
Putin, who views the volatile Caucasus as part of Russia's "near abroad", wants Muslim Azerbaijan and Christian Armenia to bury their historic rivalries and make peace.
Not so Erdogan, who is urging Azerbaijan to press on with its campaign until Armenian separatists withdraw "from every span of Azerbaijani territory".
"Turkey and Russia are engaged in a relationship which can be best characterised as competitive cooperation," said Ozgur Unluhisarcikli, Ankara office director of the US German Marshall Fund.
"The South Caucasus is among the regions where this competition is most intense."
- Putin's anger -
The Kremlin supplies arms to both Yerevan and Baku, although Armenia -- while poorer and smaller than its resource-rich eastern neighbour -- is also part of a Moscow defence alliance and hosts a Russian base.
Turkey, meanwhile, views Azerbaijan as a brotherly nation whose interests it will defend on the global stage.
While their differences in the Caucasus are not yet as stark as they have been on the battlefields of Syria and Libya, where Moscow and Ankara back opposing sides, analysts said the situation was fraught with risks.
Erdogan appears to know Putin's limits, stopping short of backing Baku militarily and keeping mum about reports that Turkey was sending Libyan or Syrian mercenaries to the Caucasus.
And weighing its own interests, the Kremlin has shown only tepid support for Armenia, whose current prime minister, Nikol Pashinyan, has previously irritated Moscow.
"Turkey's support to Azerbaijan is not new, but Russia's reluctance to back Armenia is. So I don't think Erdogan is attracting Putin's anger, yet," Unluhisarcikli said.
But if Russia feels threatened "to the extent that it is worth dismantling the relationship it has been developing with Turkey, it can retaliate in Libya and more likely in Syria," Unluhisarcikli said.
- Mutual mistrust -
Turkey's Ottoman empire never got along comfortably with the Russian tsarist one, and Moscow's more recent relationship with Ankara has exhibited signs of mutual mistrust.
And while historic, Turkey's hostilities with Armenia are now defined by one of the darkest episodes of Ottoman empire's demise, with the two countries still unable to reconcile the 1915 Armenian genocide.
Erdogan's unlikely courtship of Putin began after he survived a failed Turkish coup in 2016, when Russia was feeling isolated internationally in the wake of its annexation of Crimea.
Erdogan and Putin began cooperating more closely in Syria, where Russia backs the regime of President Bashar al-Assad, and Turkey supported the insurgency trying to topple him.
Yet it was always an uneasy alliance.
More than 30 Turkish soldiers have died this year alone in northwestern Syria.
The strains have been compounded in Libya, where Turkey supports a UN-recognised government in the west, and Russia helps the eastern-based commander Khalifa Haftar with fighters from the Kremlin-linked Wagner group.
"Turkey-Russia relations were already very complicated because of Syria and Libya. The Azerbaijan-Armenia conflict will further complicate this relation," said Ankara-based analyst Ali Bakeer.
- 'Common language' -
While Putin might be wary of Erdogan's push into the Caucasus, Bakeer said Turkey views Syria as part of its own "backyard" in which Russia is meddling.
"The latest disagreement (in northwest Syria) shows that Moscow is not willing to make things easy for Ankara," he said.
Alexei Khlebnikov, a Middle East analyst with the Russian International Affairs Council, agreed that Turkey's diplomatic posturing in Nagorno Karabakh could affect its relations with Russia in other hotspots, particularly Syria.
"Not in a major way, but there will be some influence," Khlebnikov said.
"We know that in the past years Russia and Turkey have gone through more than a few crisis situations that couldn't cardinally drive a wedge between the two countries," Khlebnikov said.
"Russia and Turkey will try to find a common language, but there are no guarantees."
Emre Kaya, of Istanbul's Centre for Economics and Foreign Policy Studies, said Russia was most likely to retaliate if Ankara went beyond supplying Baku with intelligence and logistical support -- or if Azerbaiajan made swift military gains.
"Then we could definitely expect a Russian-backed attack on Turkish troops stationed in Syria or Libya," Kaya said.