By Steven R Hurst for The Associated Press President Barack Obama scored two key foreign policy victories this week _ a new round of U.N. sanctions on Iran even as he kept Israeli-Palestinian talks on life support after the Israeli attack on Turkish ship carrying aid to Gaza. The unintended costs may be heavy.

Both issues threaten key alliances with Muslim Turkey. And both test the ability of the U.S. and Israeli to cope with Ankara’s move out of the Western and NATO orbit toward largely Islamic regions of the Middle East and Central Asia. That matters because the United States is losing sway with its longtime NATO anchor, a democracy that bridges Europe to Asia and the Middle East.

Israel too is struggling to avoid Turkey’s threatened estrangement _ a break that would cost the Jewish state its only Muslim military ally. Turkey was one of the first countries to recognize Israel after its establishment more than six decades ago. The widening fissures in both alliances likely carry heavier psychological than strategic implications for the time being, particularly for Israel.

Here’s why. Turkish Prime Minister Recep Tayyip Erdogan “suddenly is the most popular politician in the Arab world and he doesn’t speak a word of Arabic,” asserts Henri Barkey of the Carnegie Endowment for International Peace.

Erdogan’s popularity grew exponentially after the Israeli commando raid on a Turkish-sanction flotilla of aid ships bound for Gaza. Muslims across the Middle East are holding him up as a hero for his tough talk against the Jewish state in their midst. That’s a stunning reversal. Turks, who migrated into modern day Turkey from Central Asia centuries ago, had always been seen in the Arab world as heirs to the Ottoman empire that had oppressed Arabs for 400 years.

Erdogan received a thunderous reception from fellow Muslim leaders Thursday at the Turkish-Arab Economic Forum that opened with calls for an international investigation of the May 31 Israeli raid that killed eight Turkish activists and a Turkish-American teenager. Erdogan’s Islamic-rooted Justice and Development Party came to power in 2002 in a landslide victory, a clear shift away from Turkey’s secular traditions that were established in the modern state, the post World War I and shrunken remnant of the Ottoman Empire.

The political shift was a clear precursor of Turkey’s move toward a more comfortable and powerful place in the Muslim world, despite continued efforts for membership in the European Union. Erdogan has since taken to championing the Palestinians’ cause, often more loudly than their fellow Arabs. That had badly strained Israeli-Turkish relations even before the crisis that blew up around the Gaza aid flotilla.

Then there was Turkey’s insertion of itself into the effort to move Iran away from uranium enrichment and its alleged program to build a nuclear weapon. After Iran rejected a deal to swap nuclear fuel last fall, the United States was determined to impose a fourth round of U.N. sanctions on Tehran. Washington had the backing of fellow U.N. Security Council members France and Britain all along and was on the verge of announcing that Russia and China also were on board.

Turkey, with help from Brazil, suddenly announced that it had revived the swap deal and that Iran had agreed. That agreement, more than a half year after initially rejected by Iran, was deeply flawed.

And the next day the United States said a new sanctions package had unanimous support from all five permanent Security Council members. It thanked Turkey for its efforts but said the train had already left the station. When the council voted earlier this week, only Turkey and Brazil cast no votes. Those did little but register protest since neither country holds a veto.

In spite of its rhetoric and obstructionism, Turkey does not appear ready any time soon the break fully from the West. It has vast interests intricately woven into NATO and the European Union. Turkey has a customs union agreement with its top trading partner, Europe, and wants to become part of the EU. But there is no doubt that the tone in Turkey’s foreign policy is changing.

Although the United States has been its chief ally since the Cold War, Turkey opposed the U.S. invasion of Iraq through Turkish soil, triggering tensions with Washington. Until the late 1990s, Turkish relations with Iran were tense, with its secular, westernized government accusing Tehran of trying to export its radical Islamic regime to this predominantly Muslim but secular country. Today, Turkey wants to build deeper trade ties with Iran.

Erdogan also is building support for next year’s election by playing the Islam card _ one that appeals heavily to traditionalist, rural and Muslim voters who make up the vast majority of the electorate. “This is not being driven by foreign affairs,” said Jonathan Adelman, professor at the University of Denver. “Erdogan is winning points at home _ going back to the country’s Muslim roots.”