It is unusual for Iran to have a sudden change of heart in its foreign policy. Indeed, it can be said to be one of the firmest and most blatant when it comes to its projection of regional influence, and its rhetoric is just as bold. This has changed with the recent conflict between Azerbaijan and Armenia in Nagorno-Karabakh.
At first, Iran supported Armenia subtly while publicly remaining "neutral". However, there were reports that it sent 200 heavy armoured vehicles and supplies to help Armenia in its fight against Azerbaijan. Then there were reports of Iran shipping Russian arms to Armenia, which Tehran denied. There were also reports that Iran had allowed and facilitated the passage of hundreds of fighters from the designated terrorist group the Kurdistan Workers' Party (PKK), who were allegedly heading to Nagorno-Karabakh to fight alongside Armenian troops.
These reports triggered numerous protests across the north-west of Iran, where many of the country's Azeri citizens live. Dozens of protestors were arrested for expressing their support for Azerbaijan.
Towards the end of the conflict earlier this month, however, when Azeri forces were clearly gaining the upper hand, Iran backtracked on its stance and Supreme Leader Ali Khamenei acknowledged Azerbaijan's right to the Armenian occupied territory of Nagorno-Karabakh. Iran has since welcomed the peace deal that was agreed upon.
Why the sudden change of heart by Tehran? When it comes to the southern Caucasus, Iran is historically and geographically one of the primary powers alongside Russia and Turkey. It even provided mediation for Armenia and Azerbaijan in 1992 before those talks fell through, and was attempting to push itself as a mediator in this conflict too, before Russia took on that role.
READ: Where does Iran stand on the conflict over Nagorno-Karabakh?
Iran was also acting on its own insecurities over its sizeable Azeri population. As the country's largest minority at around a quarter of the population, nationalist ambitions have reportedly been growing amongst Iranian Azeris. There is speculation that Iran supports Armenia in order to curb such ambitions.
There are also the interests that Iran shares with Russia, which is a key ally of Armenia. Just as Iran and Russia support the same side – the Assad regime – in Syria, and have similar goals to curb US and Turkish influence in the region, Iran may also have supported Armenia for that very same reason, as it judged the Nagorno-Karabakh front to be identical to the others.
As Azerbaijani forces captured the strategic city of Shusha and were on the verge of taking the rest of the occupied territory, however, Iran realised that its strategy was wrong. It was backing the losing side, not least because Russia did not go to Armenia's rescue as many thought it would.
Weighing up its options, Tehran probably decided that the opportunity for bilateral cooperation with Azerbaijan was the best it could hope for. Nevertheless, despite its attempts to save face, the Azerbaijani victory resulted in exactly what Iran feared: a victory for Turkey and its foreign policy. While Ankara continues to support the Syrian opposition against the Iran-backed Assad regime, and contributed to the Libyan government's pushback against Field Marshal Khalifa Haftar earlier this year, Azerbaijan's success in recapturing Nagorno-Karabakh and the surrounding provinces is certainly of the biggest benefit to Turkey.
It was Ankara, after all, which openly supported Baku by selling it the kind of drones which worked so effectively in Syria and Libya, and devastated the Armenian forces. It was also Turkey which conducted joint military training exercises with Azerbaijan shortly before the fighting with Armenia broke out; deployed F-16 fighter jets in the country in case of Armenian attacks; and offered its direct military support if necessary.
Factor in the increased cooperation between the two countries in recent years, and the issue becomes clearer. Last month, as the conflict was still raging, it was announced that the strategic Trans-Anatolian Natural Gas Pipeline (TANAP) was ready to begin operations and deliver gas directly from Azerbaijan to Europe for the first time. With much of the TANAP passing through Turkey, it means that it will import more gas from Azerbaijan and reduce its dependence on Russia and Iran, as will the other countries benefiting from the pipeline.
READ: Turkey's strategic victory in Nagorno-Karabakh
It was reported earlier that Azerbaijan has become Turkey's main supplier of gas over the first eight months of this year, surpassing both Russia and Iran. Moreover, it was revealed in June that Turkey's state gas grid operator Botaş is to build a gas pipeline to supply the Azerbaijani exclave of Nakhchivan, which immediately threatened to sideline Iran's gas supply to the area.
Following the Russian-brokered peace deal between Azerbaijan and Armenia, the Turkish parliament yesterday approved the deployment of troops to Nagorno-Karabakh to help facilitate its implementation. This gives Turkey a further stake in the region and allows the presence of its military there along with Russian troops, leaving Iran as the only neighbouring power without a say in the matter.
The result of this is that Turkey has drawn the southern Caucasus closer into its sphere of influence, while Iran missed the opportunity of doing so because of a seemingly uncertain policy towards the conflict. Iran now has to keep abreast of events while building on whatever cooperation it still maintains with Azerbaijan and considering Russia as a potential partner.
All of this is a far cry from Iran's potential as a reliable mediator in the 1990s. It now seems that the only influence it can exert in the southern Caucasus and Azerbaijan is cultural.
The views expressed in this article belong to the author and do not necessarily reflect the editorial policy of Middle East Monitor.