Once friends, Turkey and Iran are finding that their reactions to the Arab Spring revolutions are driving them apart and renewing an old regional rivalry.

One sign of the deepening divide was obvious from the attendee list for an international conference on Afghanistan security that opened today in Istanbul.

Every primary player is here: 14 regional nations, with the presidents of Afghanistan and Pakistan in attendance, as well as more than a dozen other countries, including the United States. But Iran had planned to send just its low-ranking deputy foreign minister, despite its long border with Afghanistan and claims of being a regional superpower.

While Iran relented at the last minute and sent Foreign Minister Ali Akbar Salehi, the diplomatic tension indicates how the people-power uprisings have helped transform the Turkey-Iran friendship into an escalating rivalry.

So far, analysts say, Turkey appears the winner in pushing for secular, democratic outcomes in Tunisia, Libya, Egypt, and especially Syria – even if more by default than by design. And Iran, offering little more than nondemocratic Islamic rule and anti-Western vitriol, at this point appears the loser.

The result is a rekindling of a centuries-old rivalry for influence between the Persians and the Ottomans, with an outcome that "will affect the security architecture of the Middle East for years to come," according to Gonul Tol and Alex Vatanka of the Middle East Institute in Washington in a recent analysis.

Iran has claimed, with scant evidence, that the Arab Spring changes are an "Islamic Awakening" modeled after Iran's own 1979 Islamic Revolution. Popular protests against the regime of Iran's close ally Syria are an exception, argues Tehran.

Those views – and Iran's brutal 2009 crackdown against its own pro-democracy protests – have undermined Iran's appeal across the Arab world, even as Turkey has gained more traction as a model that blends secular, democratic rule with an Islamist bent.

Turkey shifts support from autocrats to democrats

The fast-emerging split between the former allies is perhaps most clear in Syria, where Turkey and Iran now have dramatically opposing views about the repressive actions of President Bashar al-Assad.

On Tuesday, Turkish Prime Minister Recep Tayyip Erdogan praised the months-long uprising in Syria, calling the 3,000 who have died there at the hands of security forces "martyrs."

"The Syrian people will achieve results from their glorious resistance," Mr. Erdogan said. "Democracy will show its true self in Syria. Justice and freedom will be obtained by the Syrian people by their own will."

Yet until the Arab Spring took root earlier this year, Turkey had been cozying up to authoritarian powers with little apparent regard for the regional "democracy" that it espouses today.

In 2009, Syria's president and his Turkish counterpart affectionately called each other "brother." Erdogan said Syria is "our second home" and Assad hailed their "joint future" as a model of "brotherly ties." But Turkey's top priority appeared to be economic and political connections, not yielding to the popular will.

"Turkey had gone overboard in making these kind of gestures," says Ersin Kalaycioglu, a political scientist at Sabanci University in Istanbul.

"Earlier, the only major forces that Turkey supported were the anti-Israeli, relatively radical forces such as Hamas," says Mr. Kalaycioglu. "Now that democracy is a rising force, Turkey seems to be shifting grounds, ditching [Libyan leader Muammar] Qaddafi first, and then Bashar al-Assad, and also supporting developments in Egypt as much as possible."

Turkey moves back toward the West

On many fronts, Turkey's rhetoric – including its increasingly strident anti-Israeli views – had prompted Western analysts to question whether the NATO ally was forsaking its pro-West outlook to join the Iranian-led axis of resistance.

But the Arab Spring has changed Turkey's calculation. That may have factored in to Turkey's decision in September to end years of foot-dragging and accept US anti-missile radar units on Turkish soil – part of a NATO missile shield aimed at thwarting Iranian ballistic missiles.

Turkey's adjusted approach is not a "coordinated number of steps, following each other, complementing each other," adds Kalaycioglu. "Rather there are lots of disparities, trials and errors, some erratic moves, and it looks as if the Turkish government currently is testing the waters.... The former policy is completely down the drain, of 'zero problems with neighbors.' Now we have mounting problems with neighbors."

Iranian officials have sharply criticized Turkey as a sellout to the West, but recent polling of Arab views indicate that they don't buy it, and Iran's popularity has dropped.

"Not only have Arab revolutionaries and protesters seen right through Iran's clumsy attempt to claim some credit for the Arab Spring, but Turkey has adroitly capitalized on the dramatic changes taking place in the Middle East to increase its influence and prestige among Arab publics, at the expense of its former partnership with Iran," write Mr. Tol and Mr. Vatanka of the Middle East Institute in Washington in their analysis, published this week on the Tehran Bureau website.

"The recent actions of the Turks have now effectively killed any Iranian hopes that Ankara will join the so-called rejectionist camp made up of Iran, Syria, Hamas, and Hezbollah aimed at confronting the West," they write. Instead, Turkey has shown that its "basic security interests are anchored to the West."

Iran left fuming on the sidelines

Iranian-Turkish relations began to improve when Erdogan's Islamist-rooted Justice and Development Party (AKP) came to power in 2002.

Turkey came to be viewed by Iran as a trusted interlocutor on the nuclear issue, among other things. In May 2010, Turkey and Brazil facilitated a nuclear fuel swap agreement with Tehran in a bid to forestall a fourth round of United Nations sanctions against Iran.

Turkey's sharp rebuke of Israel over the Gaza flotilla incident that same month added to the sense of Turkey moving out of the Western orbit. Israeli commandos boarded the flagship of a largely Turkish aid flotilla aimed at breaking the Israeli siege on Gaza, killing eight Turks and a dual US-Turkish citizen.

The Turkey-Israel alliance soured, Turkey cut off military ties, and the large flow of tourists from the Jewish state dried up – all prompting more Iranian rhetoric that Turkey was on the right side of history.

That was Tehran's view, too, when Erdogan forged a personal friendship with Assad, whose family has ruled Syria with an iron fist for more than four decades.

But months of street unrest across Syria, and repressive attempts to crush it that prompted thousands of Syrians to flee across the border into camps in Turkey, prompted Erdogan to finally cut ties with Assad in September.

Turkey has since hosted several meetings of the Syrian opposition – including one in Istanbul that saw the creation of an exiled Syrian National Council in September – and more recently has provided a haven for ranking officers deserting from the Syrian Army.

Iran, as Syria's primary backer in the region, has been furious, but could do nothing but complain loudly – and watch from the sidelines as Erdogan took a "victory" lap through Egypt, Libya, and Tunisia in September to cement ties with new revolutionaries and call for "Islamic democracy."

Iranian officials have made no such high-profile visits.

"There was no concern [by Turkey] about democracy until the summer of 2011 in Syria," says Kalaycioglu. "Previously there was the same authoritarian regime [in Syria], and we were getting enormously close to it, unnecessarily close to it. Therefore I'm not sure that democracy played any role.... I'm going to disregard that as empty rhetoric."

Get daily or weekly updates from CSMonitor.com delivered to your inbox. Sign up today.