Turkish PM Erdogan (left) with Iranian President Ahmadinejad last September. (Courtesy Reuters)

One of the most controversial elements of Turkish foreign policy has been the attempt by the Justice and Development party (AKP) to cultivate closer ties to Iran. Prime Minister Recep Tayyip Erdogan's rapprochement with Tehran has raised concerns in Western capitals that Ankara is drifting away from the West. Differences over Iran's nuclear program have heightened these fears. In defiance of the United States and other key NATO members, such as the United Kingdom and France, Turkey has downplayed the danger posed by Iran's nuclear policy and attempt to elude constraints imposed by the Nuclear Nonproliferation Treaty. The most acute example was in June 2010, when, bucking its Western allies, Ankara voted against a new UN sanctions regime that would target Iran's military.

Worries about Ankara's eastward drift, however, exaggerate the degree of common interests between Turkey and Iran. Beneath an amicable veneer, relations between the two countries are marked by mistrust and unease. Turkey and Iran have been strategic rivals since the sixteenth and seventeenth centuries, when the Persian Safavid dynasty blunted the Ottoman Empire's eastward expansion. The Arab Spring has given this historical rivalry new life. Since the summer of 2011, conflicts between the two countries have become more visible on Syria, missile defense, secularism, Palestine, Iraq, and the Kurdish issue. As pressures for greater democracy in the Middle East have intensified, Turkey and Iran have clashed more openly and each side has sought to expand its influence at the expense of the other.

Syria marks the most serious source of discord. Ankara's vociferous criticism of Syrian President Bashar al-Assad, as well as its support for the Syrian opposition, has angered Iranian leaders. Syria is Iran's closest ally. Assad's downfall would deal a major blow to Iran's regional ambitions and leave Tehran ever more isolated. Consequently, in recent months, the ayatollahs in Iran have stepped up military support for Assad and, at the same time, accused Erdogan of openly interfering in Syrian internal affairs. Tensions increased at the end of June, after Syria downed a Turkish fighter jet. In response, Erdogan bluntly warned Damascus to keep troops away from the Turkish-Syrian border and requested a special meeting with its NATO allies to discuss a common approach.

Beyond Syria, Ankara's agreement last September to host a NATO early-warning radar on Turkish soil has also infuriated the ayatollahs. Iranian commentators have claimed that the missile shield aims to protect Israel and target Iranian missiles. Last October, General Massoud Jazayeri, the deputy head of the Iranian armed forces, called on Turkey to "rethink its long-term strategic interests and draw lessons from the bitter historical experiences of other countries." Turkey, however, has shown no sign of backing down.

To add insult to Iranian injury, the same month as the announcement about the NATO radar, Erdogan made a tour of northern Africa. In Cairo, his remarks about the importance of secularism drew strong criticism from the Iranian leadership. Clerics in Tehran, including Ayatollah Mahmoud Hashemi Shahroudi, a former chief of the judiciary and a close adviser to Supreme Leader Ali Khamenei, accused Turkey of promoting a westernized version of Islam to advance its regional ambitions. Shahroudi's criticism reflects Tehran's concern about the popularity of the Turkish model, with its emphasis on democracy and secularism. But it also speaks to fears in Iran that Turkey is winning the political-ideological struggle for the allegiance of an increasing number of Muslims across the Middle East.

But it is not only in Cairo that Erdogan has trampled on issues that Tehran considers its own. In championing Palestinian rights, Erdogan has, in effect, hijacked the Palestinian issue and stolen Iran's thunder. His support and his strident criticism of the Israeli offensive in Gaza increased his popularity on the Arab street. Today, he is seen by many Arabs as the only Muslim leader willing to stand up to Israel and forcefully defend Muslim interests. This has left the Iranian leadership fuming on the sidelines, struggling to get back in the game but with no viable plan for doing so.

Since the end of 2011, Iraq has also emerged as an important battleground between Turkey and Iran. The withdrawal of U.S. combat forces has left a power vacuum there that Iran has sought to exploit. Turkey has an interest in a stable, economically prosperous, and independent Iraq. It does not want to see the country turned into an Iranian satellite or become a springboard for the expansion of radical Islamist ideology.

However, over the last year, Erdogan's relationship with Iraqi Prime Minister Nouri al-Maliki's government has deteriorated. Maliki is widely viewed by Ankara as Tehran's man in Baghdad. He has close ties to the Iranian leadership, built up during his years of exile in Iran during Saddam Hussein's rule. Since the withdrawal of U.S. troops from Iraq, he has steadily sought to consolidate his political power. His attempt to strengthen ties with the radical militant group Asaib Ahl al-Haq, which the U.S. military claims is financed and trained by Iran's elite Quds Force, has alarmed Turkish officials who fear that these ties could shift the balance of political power in Baghdad in Iran's favor.

The tension between Maliki and Erdogan intensified last January, after Maliki issued a warrant for the arrest of Iraqi Vice President Tariq al-Hashimi, a Sunni who was charged with abetting terrorism. Hashimi subsequently fled to northern Iraq, where he has been under the protection of the Kurdish regional government, which has refused Baghdad's request for his extradition. Turkish officials saw Maliki's gambit as an effort to undercut the Sunnis and Kurds and increase Shia political dominance. They fear that Maliki's attempt to curtail Sunni and Kurdish influence could increase the risk of a return to sectarian violence and lead to the breakup of Iraq, with the Kurds in the north gaining full independence.

Moreover, as a result of the increased unrest in Syria, the Kurdish issue is rapidly acquiring an important new dimension. It is no longer a disparate issue in separate countries where Kurdish communities reside. Contact between the Kurds in Iran, Iraq, Syria, and Turkey is increasing in an attempt to develop a coordinated approach. At the same time, the PKK (the Kurdistan Workers' Party, which has been fighting Turkey for Kurdish independence since 1984) has stepped up its attacks from its havens in the Qandil mountains in northern Iraq. Turkish officials worry that Iran and Syria could actively support the PKK, as they did in the l980s and early 1990s, in order to try to weaken Ankara.

Economic problems between Turkey and Iran have risen as well. In the last decade, trade and financial ties have expanded significantly, especially in the energy field. Iran is the second-largest supplier of natural gas to Turkey, behind Russia. It also provides 30 percent of Turkey's crude oil imports. But on several occasions, Iran abruptly cut off gas to Turkey for several weeks. Those stoppages, largely due to Iran's antiquated distribution infrastructure, have caused considerable economic hardship for Turkey's population and tarnished Iran's reputation as a reliable partner. The closed nature of Iran's economy has created significant difficulties as well. Turkish exporters face high tariffs on consumer goods, frequent changes in tariff rates, delays in import permits, overpriced fuel during transport, and prolonged delays at customs gates. These obstacles have caused many exporters to curtail business with Iran and seek more hospitable markets for their goods.

Finally, the growing instability in the Middle East unleashed by the Arab Spring has prompted Ankara to align its policy more closely with Washington. In addition to the decision to deploy the NATO early-warning radar, in April Erdogan, in tandem with U.S. sanctions, agreed to reduce oil purchases from Tehran by 20 percent. These moves do not, however, mark a fundamental shift in Turkish policy toward Iran. As in the past, Ankara is likely to remain reluctant to join an openly anti-Iranian coalition. However, any honeymoon between Turkey and Iran is clearly over. In the coming decade, the struggle for regional influence between the two powers is likely to grow and increasingly reshape the politics of the Middle East.