In the eyes of Ankara, there is a visible linear axis linking Tehran to Damascus crossing over Baghdad. This is enhanced by a resurgent Russia that could undermine Turkey’s regional standing even further, following the latest conflict that erupted after the downing of the Russian fighter jet by missiles fired from a Turkish F-16 on Nov. 24.

The PKK and YPG also played an important role in Iraq in the liberation of the town of Sinjar from IS. Sinjar commands the most important road linking Raqqa, the de facto capital of IS in Syria, with its most important reward, Mosul, considered to be a Sunni bastion against the capital, Baghdad, and its Shiite politicians. IS took over Mosul in June 2014.

The Turkish move, involving Bashiqa, a town just north of Mosul, does have a rationale in the broader regional framework in which a Russia-Iran axis, also aligned with Baghdad, is overtly imposing itself over Syria. Such an axis would be attractive also for Turkey's Kurdish insurgent Kurdistan Workers Party (PKK), whose affiliates the Democratic Union Party (PYD) and People's Protection Units (YPG) are proving themselves as the most reliable and strongest fighting forces on the ground in Syria against the Islamic State (IS).

Turkey is already entangled in a crisis with Russia that has the potential of escalating dangerously. For many, opening up a new front for controversy — this time with Baghdad — may not seem a wise move, but it needs to be assessed within a broader regional context.

In an Al-Monitor article on Dec. 7, Metin Gurcan discusses Turkey’s latest and controversial move near Mosul that aroused the fury of Iraqi Prime Minister Haider al-Abadi's government in Baghdad and brought Kurdistan Regional Government (KRG) President Massoud Barzani to Ankara. He also supplied invaluable technical details of the military dimension of the move.

As the siege against IS in Mosul sends optimistic signals that the city could be liberated in the foreseeable future, Turkey, keeping this geopolitical situation in mind, has been prompted to move.

As a matter of fact, taking history into account, it may be seen as no more than a replay of perennial Turco-Persian or Turkish-Iranian rivalry in and over Mesopotamia. Ottoman Turkey and Safavid Iran fought over Mesopotamia for the control over today’s Iraq several times in the 16th and 17th centuries.

The Safavids, a Turkish dynasty that once ruled what is today Iran, declared Shiism as the state religion of their empire. Until Shah Ismail transformed the empire in the land of ancient Persia, its subjects were predominantly Sunni. Adding to the theological dimension of the matter, ever since the first half of the 16th century, Shiite Iran and Sunni Turkey — irrespective of the nature of their regimes and who is ruling them — have been geopolitical rivals, and their competition mostly has been reflected over the territory and the communities of Mesopotamia.

Baghdad itself changed hands several times. It was under Safavid rule between 1508 and 1534, before it fell into Ottoman-Turkish hands in 1638. It was the British capture of the city in 1917 that ended years of Sunni-Ottoman-Turkish rule over the Shiite Arabs.

The wars between the Ottomans and the Safavids ceased in 1638 with the Treaty of Qasr-e Shirin that drew the frontiers between what are Iran and Turkey today, and between Iran and what is Iraq today (with minor modifications). Both sides, when it comes to boast about the depth of their good neighborly relations, refer to this treaty that is nearly 150 years older than the foundation of the United States of America.

Although Turkey and Iran have never fought since then, they have acknowledged each other's regional standing and privileges; their competition in different arenas is not as acute and deep as between the Shiites and Sunnis of Iraq.

Following the US invasion of Iraq in 2003, the Shiites for the first time ruled Baghdad, further alienating the Sunnis and paving the road for the emergence of Sunni extremist organizations such as “al-Qaeda of Mesopotamia” that ultimately transformed itself into the Islamic State of Iraq and Syria and subsequently IS.

As Baghdad is seen moving to Tehran’s orbit today, the conditions for an Ankara-Erbil (KRG) rapprochement have become timely and significant. It has become a geopolitical imperative.

The Islamist government of President Recep Tayyip Erdogan and Prime Minister Ahmet Davutoglu in Turkey proved more and more to be the sponsors and the protectors of the Sunni Arabs of Iraq and acted in mediating between the Barzani-ruled KRG and Sunni Arab notables, particularly those of the Nujaifi clan of Mosul, the capital of Ninevah province.

Thanks to Turkish efforts, Osama al-Nujaifi has been elected as the speaker of the Iraqi parliament in Baghdad with Kurdish support, while his brother Atheel was governor of Ninevah province from 2009 until this year, albeit of a truncated province after IS took Mosul.

With this in mind, it should not be difficult to look for and find a rationale in Turkey’s latest move involving Mosul. In fact, on the day of Barzani’s visit to Turkey’s capital, Erdogan explained the motives of deployment quite clearly in an interview with the Arabic-language Al Jazeera network. He said Abadi himself had asked for Turkey’s assistance in the military training of Iraqis; the training camp in Bashiqa was subsequently established. Erdogan then nervously took issue with the latest position of the Iraqi prime minister, saying, “Where were you and what were you doing while the Bashiqa camp was being constructed? You have been silent since. You are now taking [a negative] position in assessing the latest developments in the region.”

Erdogan, in the Al Jazeera interview, accused the Iranian and Iraqi governments of following “sectarian policies” in Iraq and Syria, and emphasized the security needs of Sunnis in the region.

“Turkey is against sectarian politics. It is obvious who are involved in sectarianism. Who are they? Iran. Iraq. Today, Iraq, unfortunately, is cooperating with Iran in terms of sectarianism. The same cooperation is in force also in Syria. What is the underlying problem of Syria’s troubles? Again, sectarianism!” he said.

Erdogan, speaking about Turkey’s latest move involving Mosul and the situation of Sunnis in the region, said, “At this moment, while such a step is taken, what would become of the situation of the Sunnis here in the region? There are Sunni Arabs, Sunni Turkmens and also Sunni Kurds. They all have the need for self-defense through train-and-equip efforts. All the steps taken [by Turkey] aim at that.”

Davutoglu added an additional geopolitical dimension to the affair. In advocating close relations with Barzani's KRG, he said, “The Turkish soldiers are at Bashiqa for the stability of the region. Because we do not want to become neighbors with [IS] and for that Erbil has to be strong.”

Apart from the need to have the KRG act as a “buffer” between Turkey and IS, the close relationship with Iraq's Kurdistan Democratic Party — boosted by Turkey's military presence at the gates of Mosul — gives an edge to Ankara to scuttle any semblance of Kurdish self-rule of a PKK-affiliate in northern and eastern Syria that would be a rival to Barzani in the pan-Kurdish movement.

It is also another reflection of Turkish-Iranian rivalry on the Kurdish political landscape and over Mesopotamia.

Iran, the second-largest natural gas provider to Turkey, announced that it halved its exports to right after the Mosul-Bashiqa affair. It could not be coincidental.

The shadow of history and the replay of Turkish-Iranian rivalry in Mesopotamia is present under the new circumstances, conditions and ever-changing regional alignments of the 21st century.