Turkey’s Chief of the General Staff Hulusi Akar will visit Tehran in the near future for further consultations on boosting defense ties and counterterrorism cooperation between the two countries, the Iranian media today. The announcement was made on Monday by the chief of staff of the Iranian Armed Forces, Major General Mohammad Hossein Bagheri, who just returned from a high-level and unprecedented visit to Ankara. Bagheri told reporters in Tehran today that the upcoming visit by the Turkish military delegation will aim to “complete and conclude the negotiations” held during his recent visit to Ankara. The top Iranian commander also noted that Tehran and Ankara have reached agreements on border security as well as cooperation to resolve the political and security challenges in Syria and Iraq.

Comment: The planned trip by the top Turkish military official to Tehran is the latest indication of warming relations between the two countries.

On Wednesday, Bagheri met with Turkish President Recep Tayyip Erdogan and Defense Minister Nurettin Canikli in Ankara to of boosting bilateral defense ties and narrowing the two countries’ policy differences in Syria and Iraq. The two sides reportedly agreed to cooperate on the enforcement of de-escalation zones in Syria and pressure the Iraqi Kurdistan government not to go ahead with its plan to hold an independence referendum next month. After meeting with Erdogan today, Bagheri also announced that the Turkish president will soon visit Tehran.

And on Monday, Erdogan further that Turkey and Iran have discussed possible joint military action against Kurdish militants groups – the outlawed Kurdistan Workers Party (P.K.K.) and its Iranian affiliate P.J.A.K. "Joint action against terrorist groups that have become a threat is always on the agenda. This issue has been discussed between the two military chiefs, and I discussed more broadly how this should be carried out," Erdogan said.

The latest steps by the two countries to improve their relations should be seen within changing regional and international contexts.

The Islamic Republic believes that it has “defeated” its regional rivals in Syria and Iraq. Tehran is therefore now willing to work with Ankara to defuse tension and consolidate and sustain its gains.

Turkey, on the other hand, has failed to convince the Trump administration to stop supporting Kurdish forces in northern Syria or take an aggressive approach toward Iranian-backed militia forces in Syria and Iraq. Despite Turkish concern, for example, the U.S. military gave the Iranian-backed Iraqi paramilitary forces the green light to participate in the Tal Afar operation. It is no surprise that Turkey is now seeking to address some of its national security concerns in the region through working more closely with Russia and Iran.

But the transactional relationship between Tehran and Ankara is unlikely to transform into an alliance as the two countries will continue to have divergent policies and interests in the Middle East. Ankara and Tehran will continue to compete for power and influence in Syria and Iraq as the weakening of the ISIS creates a power vacuum in the region. Turkey is positioning itself as the protector of the Sunni communities in Syria and Iraq as well as the broader region, while Iran is expanding its arc of influence through the region's Shiite communities.