What is behind the hostility between Iran and Turkey?

Diplomatic tensions between Iran and Turkey will not result in an actual confrontation due to the vast economic ties between the regional rivals, Turkish analysts say.

As both regional rivals compete for a greater share of influence in the region, the Syrian government's victory in Aleppo, coupled with the Islamic State of Iraq and the Levant (ISIL, also known as ISIS) group's diminishing presence in Iraq, has brought tensions between them to the boil.

"The tensions between Turkey and Iran did not appear out of the blue," said Atilla Yesilada, a political analyst with Istanbul's Global Source Partners.

"This rivalry had been simmering beneath the surface for a very long time. Recent developments in Syria and Iraq simply forced the two countries to be more overtly aggressive against each other," Yesilada told Al Jazeera.

Over the past week, diplomatic tensions have escalated between regional rivals Turkey and Iran after Ankara blamed Tehran of pursuing a sectarian agenda and destabilising the Middle East.

Regional politics may cause tensions between the two countries, but in the light of their strong economic ties, I don't believe the recent escalation in diplomatic tensions is going to lead to a serious confrontation"

Erdem Aydin, Bogazici University

Turkey 's President Recep Tayyip Erdogan accused Iran of trying to split Iraq and Syria by resorting to "Persian nationalism", while Mevlut Cavusoglu, Turkey's foreign minister, criticised what he called Iran's "sectarian policy" aimed at undermining Bahrain and Saudi Arabia.

"Iran is trying to create two Shia states in Syria and Iraq. This is very dangerous. It must be stopped," Cavusoglu said at the Munich conference on 19 February.

In response, Iran summoned the Turkish ambassador over these remarks and warned Turkey that its patience "had limits", and if Turkish officials continue making such statements "it will not remain silent".

Turkey and Iran have been on opposite sides of the conflict in Syria, with Ankara seeking to overthrow President Bashar al-Assad and Tehran being, along with Russia, his key backer.

And in Iraq, Turkey claims that it has a "historical responsibility" to protect the country's Sunni and Turkmen minorities from Iran-backed Shia militias who are in the region to fight ISIL. Iran, on the other hand, alongside with Iraq's government, views Turkey's involvement in the conflict and military presence in the country as an "incursion".

"Turkey acts as the protector of Sunnis in the region, while Iran wants to build a Shia circle of influence all the way from Tehran to Lebanon, so it is inevitable for these two regional powers to clash," Yesilada added.

Yesilada explained that as ISIL is steadily losing large swaths of territory in both Iraq and Syria, a significant power vacuum is forming along Turkey's southeastern border, causing Iran and Turkey to clash over who is going to replace the dominant force in the area.

"ISIL is about to leave the stage for good, and Turkey is extremely worried about its replacement," Yesilada said. "If it doesn't act immediately and forcefully, Iran-backed militias, Bashar al-Assad or the People's Protection Units (YPG), a group Turkey considers to be a terrorist organisation, can take over territories previously controlled by ISIL."

"Turkey does not want another enemy at the gates, so it is making its position known to Iran, clearly and loudly."

Iran, on the other hand, is actively working towards ending Turkey's ongoing military presence in Iraq and Syria, to make sure its allies keep controlling the area, analysts said.

Ali Akbar Velayati, a senior foreign affairs adviser to Ayatollah Ali Khamenei, recently said Turkish troops should immediately retreat from Iraq and Syria or the people would "kick them out".

Iranian president Hassan Rowhani speaks with Recep Tayyip Erdogan during their meeting at the presidential palace in Tehran in 2014 [Abedin Taherkenareh/EPA]

Iran experts in Turkey say Tehran is alarmed by Turkey's presence in Syria and Iraq.

"Iran views Turkey's military presence in these countries as a significant obstacle in front of its desire to extend its influence in the region."

Iran also wants to cut Turkey's efforts to create a Sunni controlled safe-zone in northern Syria at its roots, Aydin explained.

"The escalation of diplomatic tensions between Iran and Turkey came after President Erdogan completed a week-long tour of the Arabian peninsula," Aydin, who is also a foreign news analyst and editor for CNN Turk, said. "We have reason to believe that Erdogan asked his Saudi and Gulf allies to finance the creation of a safe zone in northern Syria during these visits and Iran was of course disturbed by this development. "

"It is also possible that the Gulf states asked Erdogan to adopt a more contentious attitude towards Iran in exchange for providing financial assistance for the safe-zone," Yesilada added.

Analysts explained US president Donald Trump's aggressive attitude towards Iran and the perception that he may be willing to support the creation of a Turkish-controlled safe zone in northern Syria also played a significant role in the escalation of tensions between Tehran and Ankara.

"It looks like Erdogan realised Trump is going to be a lot more aggressive towards Iran compared to his predecessor, so he decided to act up against Tehran to secure US support for the safe zone," Yesilada said.

Russia, of course, is also an important player in this game, Aydin added.

He explained that Russia's recent rapprochement with Turkey, as well as disagreements it has with Iran over Syria may play a significant role in the future of Turkey's relations with Iran.

"Russia and Iran are having differences of opinion regarding the future of Syria," he said. "Russia is viewing Assad as an ally, but is not insistent about him staying in his role as Syria's president.

Iran does not want Assad to go anywhere, but Russia, on the contrary, may easily sacrifice him."

"Russia is ready to get out of Syria," Yesilada said. "It is content with its victory on the ground. So it may choose not to be on Iran's side to support Assad against Turkey."

While their conflicting interests on the ground as well as actions of other actors like the United States and Russia may lead to further diplomatic tensions between Iran and Turkey, analysts said the vast economic ties between the regional rivals may prevent an actual confrontation.

"90 percent of Iran's natural gas exports go to Turkey and Turkey imports 20 percent of its natural gas from Iran, " Aydin told Al Jazeera. "Regional politics may cause tensions between the two countries, but in the light of their strong economic ties, I don't believe the recent escalation in diplomatic tensions is going to lead to a serious confrontation."

Yesilada also said that the economic ties between the two countries "cannot be overlooked" but he argued that Turkey may be ready to take the economic blow to protect its regional interests.

"It is true that Turkey is buying a lot of natural gas from Iran, and given that the Islamic Republic does not care too much about the international law, it may decide to close down the valves to teach Ankara a lesson," he said. "Also Turkish businesses had been investing heavily in Iran since the country's relations with the rest of the world was normalised following its nuclear deal with the US.

"Yet Turkey might still be willing to face any economic threat and do everything necessary to stop Iran from extending its influence further in the Middle East, because any other scenario will be politically too costly for the country."