This Opinion first appeared in Frontline's "Tehran Bureau" on April 3, 2012.

Turkish Prime Minister Recep Tayyip Erdogan's high-profile visit to Iran last week demonstrated one reality more than anything else: that Iran is very uncomfortable to have to rely on Ankara as a mediator but equally short of suitable alternative partners at the moment. Erdogan left Iran after having secured his hosts' blessing that the next round of Iranian negotiations with the P5+1 should be held in Istanbul on April 13. Given the escalation in tensions during the last year between Ankara and Tehran, this was no minor feat for Erdogan. Still, the two large regional states are set to remain at loggerheads on a number of pressing challenges in the Middle East. The primary schism right now concerns the future of the Bashar al-Assad regime in Damascus, but other regional rivalries -- including the Iranian-Turkish contest for influence in Iraq -- hugely complicate Tehran's dealings with Istanbul. The ambivalent feelings of friendship and rivalry were clearly visible throughout Erdogan's two-day stay in Iran.

Lackluster reception for ErdoganFrom the get-go, speculation was rife about Iranian receptiveness toward Erdogan. The Turkish press highlighted the fact that President Mahmoud Ahmadinejad did not receive Erdogan at the airport; in fact, the Iranian president did not see Erdogan at all on the day of his arrival, claiming to be sick. The Hürriyet Daily News pointed out that Ahmadinejad nonetheless met a lesser delegation from Turkmenistan that same day. Regardless of whether a snub was intended or not, there is little doubt that the Turkish premier's visit to Tehran in May 2010 prompted far more Iranian enthusiasm. Back then, Erdogan, together with then Brazilian President Lula da Silva, had helped draft the so-called trilateral agreement that was meant to solve Iran's nuclear dispute with the International Atomic Energy Agency and the United Nations.

The trilateral agreement was rejected by the Western states, and in the interim the unfolding Arab revolutions have put Iran and Turkey in opposite regional camps. Whereas between 2009 and the end of 2010, Iranian officials spoke euphorically of Turkey joining the "resistance block," the period since early 2011 has seen Tehran increasingly consider Turkey as not only a primary regional rival but also a country that will happily stand hand-in-hand with the West or anti-Iranian Arab states such as Saudi Arabia if it serves to advance Ankara's geopolitical interests. Key advisers to Iranian Supreme Leader Ayatollah Ali Khamenei went so far as to publicly tout the idea that Turkey -- together with Saudi Arabia and Qatar -- was pushing an American-dictated anti-Iranian agenda in the Middle East at a time when Tehran declared itself the role model behind the wave of Arab popular uprisings, which it calls the "Islamic Awakening."

At the moment, a critical issue dividing Iran and Turkey is Syria. Perhaps as a gesture of his commitment to friendly ties with Iran, Erdogan traveled to the holy city of Mashhad to see Khamenei, who likes to holiday in his hometown for the Persian New Year. There the Supreme Leader reportedly told Erdogan that Iran will maintain its support for Assad because Damascus "supports the resistance front against the Zionist regime [Israel]." Khamenei issued this declaration despite the fact that a key component in this so-called front against Israel -- Hamas -- has all but given up on the Assad regime.

Meanwhile, as Istanbul played host this past weekend to a "Friends of Syria" summit whose agenda was how to remove Assad from power, Iranian officials spoke in ever louder voices of their support for the Syrian Baathist regime.

In Beirut, Iran's deputy foreign minister, Hossein Amir Abdollahian, said Iran "would not spare any effort to" back the Syrian leadership. At no time since the Syrian uprising began have Iranian officials been so vocal in expressing support for Assad's rule, most likely because the reading in Tehran is now that Assad will not, in fact, fall and that Iran no longer needs to keep its Syrian options open.

At the "Friends of Syria" summit, Erdogan probably had the Iranians in mind when he stated that in dealing with the Syrian crisis "geopolitical interests" should not set the agenda and drive regional policies. The Iranian side meanwhile dismisses such talk as high and mighty and aimed to disguise what it perceives as Turkey's Machiavellian plan to emerge as the geopolitical winner once the the Arab revolutions wind down.

Turkish shrewdnessThe idea that Turkey is seeking regional dominance at the expense of Iran permeates almost all Iranian analysis about Istanbul's policies in the Middle East, not just Syria. Tehran sees a direct Turkish challenge to its interests in places such as Iraq, where the pro-Iranian government of Nouri al-Maliki was never Ankara's preference. Lately, the Iran-Turkey split has also began to resemble the kind of sectarian competition that has long characterized Iranian-Saudi relations. During his recent visit, the Iranian media lampooned Erdogan for voicing his support for (mainly Sunni) Syrian demonstrators but remaining quiet about the fate of the (mainly Shia) Bahraini protestors who face a Sunni ruling elite. One Iranian news outlet ran the sarcastic headline "Prime Minister, Anything Going On in Bahrain!"

Despite all these Iranian misgivings about Turkey, however, the simple fact is that Tehran needs Ankara -- probably more than vice versa. Turkey has become a key trading partner for Iran: the volume of trade between the two countries has risen from about $1 billion in 2000 to $16 billion last year. And from the Iranian perspective, Ankara plays an important role in backing its right to a nuclear program, by far the most important diplomatic challenge Tehran faces. This is a theme whose importance Erdogan recognizes, and he returned to it again and again during his visit, speaking out strongly against any military strike against Iran. The Iranian side recognizes that Turkish diplomatic support for Iran's nuclear program is self-serving, conditional, and finite but thanks to Iran's self-created isolation, the authorities in Tehran need to hang on to any token of support they can find on the international stage, regardless of how fickle.

Assertions and opinions in this publication are solely those of the above-mentioned author(s) and do not necessarily reflect the views of the Middle East Institute, which expressly does not take positions on Middle East policy.