ISTANBUL – As President Obama was feeling his way in foreign policy during his first months in office, he decided to cultivate a friendship with Turkey’s headstrong premier, Recep Tayyip Erdogan. In the past year, this investment has begun to pay big dividends — anchoring U.S. policy in a region that sometimes seems adrift.

Erdogan’s clout was on display last week as he hosted a meeting here of the World Economic Forum that celebrated the stability of the “Turkish model” of Muslim democracy amid the turmoil of the Arab Spring. One panel had the enraptured title “Turkey as a Source of Inspiration.”

In a speech Tuesday, Erdogan named Turkey’s achievements over the last decade he has been in power: Its economy has grown an average of 5.3 percent since 2002, the fastest rate of any country in the Organization for Economic Co-operation and Development; GDP has more than tripled; investment from abroad has increased more than 16 times.

For Erdogan, receiving a visit from the World Economic Forum was a kind of vindication. He had walked off stage at the group’s 2009 meeting in Davos, Switzerland, after a panel moderator (yours truly) didn’t allow him time to respond to Israeli President Shimon Peres’ remarks about the Gaza war. But last week, the Davos moment seemed well in the past.

Turkey’s ascendance may seem obvious now, but it was less so in 2009 when Obama began working to build a special relationship. To an otherwise predictable European itinerary for his first overseas trip in April 2009, he added a stop in Ankara. What impressed the Turks wasn’t just that he spoke to their parliament, but that earlier in Strasbourg he pushed for a greater role for Turkey in NATO, and in Prague argued for Turkish membership in the European Union.

Obama and Erdogan continued their courtship despite a deterioration in Turkey’s relations with Israel after the Gaza war, and despite U.S. worries in early 2010 that Ankara was becoming too friendly with Iran. Obama expressed his concerns in a blunt two-hour conversation at the June 2010 G-20 summit in Toronto. Since then, according to both sides, mutual trust has been growing.

“My prime minister sees a friend in President Obama,” says Egemen Bagis, the minister for European affairs and one of Erdogan’s closest political advisers. “The two can very candidly express their opinions. They might not always agree, but they feel confident enough to share positions.”

An example of the Obama-Erdogan channel was their meeting in March at the Asian summit in Seoul. The top item was Obama’s request that Erdogan convey a message to Iran’s supreme leader about U.S. interest in a nuclear accord. In Seoul, Erdogan also promised to reopen a Greek Orthodox seminary on the island of Halki, granting a request Obama had made in 2009; Erdogan had earlier agreed to Obama’s request that Turkey permit services at an ancient Armenian church on Akdamar Island.

Turks cite several other concessions made by the Turkish leader: Obama convinced him to install a missile-defense radar system that became operational early this year, upsetting Tehran. And at U.S. urging, Erdogan reversed his initial opposition to NATO intervention last year in Libya.

In playing the Turkey card, Obama has upset some powerful political constituencies at home. Jewish groups protest that Obama’s warming to Ankara has come even as Israel’s relationship with Turkey has chilled. Armenian groups are upset that Obama has soft-pedaled his once-emphatic call for Turkey to recognize the genocide of 1915. And human-rights groups complain that the U.S. is tolerating Erdogan’s squeeze on Turkish journalists, judges and political foes.

But as the Arab Spring has darkened, the administration has been glad for its alliance with this prosperous Muslim democracy. Ahmet Davutoglu, Turkey’s foreign minister, says his country is a role model for Arabs because it shows that democracy brings dignity — not chaos or extremism.

Bagis puts it this way: “There are many Muslim leaders who can go to Egypt and pray in a mosque. And there are many Western leaders who can go talk about democracy. Erdogan did both.”

But there’s a mutual dependence. It seems fair to say that no world leader has a greater stake in Obama’s re-election than Turkey’s prime minister.

David Ignatius writes about foreign affairs for The Washington Post. He can be contacted at:

[email protected].com