Turkish and Iranian officials have conducted a number of high-level bilateral visits recently. This suggests that the two countries are drawing closer once again, after a period of serious disagreements over Iraq and Syria. What is driving this rewarming of the relationship? And how sustainable is it?
From the AKP to the Arab Spring
Turkish-Iranian ties blossomed in the last decade under the AKP government. Whereas previous secular-based Turkish governments took a dim view of Iran, the Islamist-rooted AKP sought to build the relationship after coming to power in 2002.
High-level visits and trade deals ensued. Yet, relations between Ankara and Tehran began to deteriorate when the Arab Spring uprisings broke out in 2011.
Syria as a roadblock
The two nations were particularly at odds over Syria's civil war. Turkey threw its lot behind the rebels, whereas Iran stood fast with Bashar al-Assad's regime, its long-time client.
As a result, Turkey and Iran became locked in a proxy war. Ankara armed and sheltered the rebels, while Tehran funded Assad's military and sent forces to fight on his behalf, and both countries issuing fierce public criticisms of each other's stance in Syria.
Differences have also arisen over Iraq, where Turkey's warm ties with the Kurdistan Regional Government (KRG) have angered the Shiite-led government in Baghdad and its ally in Tehran.
Moreover, Iraq has taken issue with Turkey's encroachment into the country's Sunni Arab northern region. Most recently, Baghdad — with Iran's backing — asked Turkey to evacuate the Bashiqa base near Mosul where Ankara has built a military presence in recent years.
Easing the tension
In the past few weeks, Ankara and Tehran have signaled that are trying to set aside their differences. Turkish foreign minister Mevlut Cavusoglu traveled to Tehran on August 18 following the visit of his Iranian counterpart Mohammad Javad Zarif to Ankara on August 12. The main reason for this rewarming seems to be Syria.
The August 24 Turkish incursion into Syria — which occurred with Russia's tacit blessing (and direct, if limited, U.S. military support) — is a telling development in the relationship.
It shows that the war is evolving into many mini-conflicts: Opponents on one front (Turkey vs. Russia in Aleppo) can cooperate on another front (Jarabulus). It also shows that actors are preparing for the "day after" the Islamic State (IS) and shifting their priorities accordingly.
For instance, Turkey no longer seems completely preoccupied with ousting Assad. Instead, it is brokering a tacit peace with Russia and, implicitly, Iran.
By doing so, The Turkish government is preemptively acting to take areas that would otherwise be captured by the Democratic Union Party (PYD) and the Kurdish group that has seized much of the northern border region. The group is one of Turkey's chief adversaries in a post-IS Syria.
Who wants what?
To be sure, President Recep Tayyip Erdogan and his top Foreign Ministry officials have continued to speak out against Assad since last month's incursion. This raises questions about whether Turkey can truly abandon its policy of ousting him.
Yet, Ankara is cognizant of the fact that the current regime — and maybe even Assad himself — will likely survive for some time. That is why it has lately asked its proxies in Syria to focus more on efforts to block PYD advances.
In short, Turkey's thaw with Iran does not appear to be a strategic shift. Nor should it be interpreted as a sign that Turkey intends to leave NATO down the road. Ankara will continue to disagree with Iran's main goals in Syria.
For its part, Tehran sees the thaw as an opportunity to curry favor with Ankara and dampen Turkish objections to the Assad regime's survival.
Iranian leaders may even have asked Assad to order the recent Syrian military bombing of PYD positions in Hasaka province as a way of winning over Ankara.
Economic front co-operation
Prior to the recent military and diplomatic cooperation, the pressure of facing two powerful adversaries in Syria spurred Turkey to extend an economic olive branch to Tehran.
This helped Iran find relief from international sanctions. Tehran reciprocated by inviting Turkish businesses into the Islamic Republic.
Efforts to integrate their markets have been particularly robust this year. On February 29, Tehran held the first Iran-Turkey Capital Markets Forum to facilitate the dual listing of companies on each country's stock exchange.
On March 5, then-prime minister Ahmet Davutoglu called for removing bureaucratic trade impediments to take advantage of their complementary economies and geographies. He argued that this could help triple annual trade from $9 billion to $30 billion.
And on April 9, the Iranian and Turkish Chambers of Commerce signed three documents to strengthen economic cooperation and banking relations following the 25th session of the Joint Economic Commission in Ankara.
Improved economic relations with Iran could also open possibilities for Turkey with Iraq.
Turkey is deeply anchored in the increasingly independent Kurdistan Regional Government (KRG) in northern Iraq. But a closer relationship with the central government and its more than three million barrels per day in oil exports could bring additional diplomatic, energy and trade benefits.
Future compartmentalization and risks
Given this assortment of shared and divergent interests, Turkey and Iran will likely decide to compartmentalize their relations on different fronts.
For instance, while the two nations will continue to disagree on some aspects of Syria policy (e.g., Assad's future and the battle for Aleppo), they would both object to any scenario involving Syrian Kurdish autonomy or independence.
Iraq will likely settle on a political condominium over the Kurds. Ankara wields influence over one of the KRG's two main rival factions (the Kurdistan Democratic Party) — and Tehran maintains hegemony over the other (the Patriotic Union of Kurdistan).
Russia as a warning sign
Yet, the course of Turkish-Russian relations has shown that any such compartmentalization approach is wrought with potential pitfalls. Up until late last year, Ankara and Moscow were able to develop deep trade and energy links even while disagreeing on Syria.
In November 2015, however, Turkey shot down a Russian jet that briefly entered its airspace. This prompted the Kremlin to sever nearly all of those links — and in January 2016, even impose bilateral sanctions in January.
Similar problems could arise with Iran should the two countries' military personnel or proxies accidentally clash in Syria.
Other challenges lie in the ongoing negotiations for a peace settlement in Syria. If a deal is reached that preserves the Assad regime, Turkey's long-term instinct would be to not fully abide by its terms.
Instead, Ankara would likely offer public support for the deal while continuing to arm anti-Assad rebels, thereby angering Tehran and Moscow.
Erdogan would find it difficult to completely end Turkey's support to non-IS fighters in Syria while at the same time helping the United States fight IS. After all, he and other AKP elites identify themselves as political Islamists and they believe that supporting Islamist rebels is the right course.
The Saudis' take
Accordingly, unless Washington convinces the Syrian opposition's Saudi and Qatari backers to cut financial support and fully acquiesce to a peace deal, Turkey would likely continue funneling some weapons and money to rebel groups, including extremist factions.
Saudi Arabia would take a dim view of a U.S.-Russian deal in Syria, seeing it as handing the country over to Iranian/Shiite control.
Yet, even if Riyadh were to come on board with such a deal, some portions of the amorphous Saudi elite would likely reject it and continue helping the rebels, mainly via Turkey.
In the long term, this seems like the biggest threat to Turkish-Iranian ties under a compartmentalization scenario.
Turkey is wary of the Iranians and their regional aims, but it also wants to pursue a pragmatic relationship because of the need for economic cooperation, particularly on energy.
Speaking at the UN General Assembly earlier this month, Erdogan called for a safe haven in northern Syria spanning some 5,000 square kilometers. That is much larger than the nearly 1,000 square kilometers of border territory currently controlled by Turkey and its rebel proxies.
This suggests that Ankara will be the non-IS opposition's main sponsor in the north going forward. Iran and Russia may be willing to live with such a zone, but that would be a considerable climb-down from Assad's pledge to retake the entire country.
In the short term, the sustainability of Turkey and Iran's rewarming ties will depend on the extent to which they can avoid a scenario similar to the November shootdown incident with Russia.
It will also depend on whether Ankara can withstand Saudi pressure to boost support for anti-Assad jihadists.