ANKARA (Reuters) - A bitter rift with Iraq has exposed Turkey's role in a wider Middle East power struggle, with Ankara acting to protect its stability and prosperity from an Iranian-Iraqi "Shi'ite axis" it fears in the wake of the U.S. military withdrawal from Iraq.
Turkey, a Sunni Muslim but secular regional power bordering Iraq, Iran and Syria, long tried to play regional mediator as Shi'ite Muslim giant Iran and Sunni powerhouse Saudi Arabia jostled for sway in a region now undergoing political upheaval.
But the fall-out wrought by Arab Spring uprisings and the U.S. exit from Iraq have forced Turkey to make tricky adjustments by cutting old alliances and forming new ones, jettisoning its "zero problems with the neighbors" policy.
That shift, coupled with a more aggressive diplomacy personified by an increasingly combative Prime Minister Tayyip Erdogan - has thrust Turkey into a regional strategic game pitting Gulf Arab states and Ankara against Iran.
"What is really critical is the American withdrawal from Iraq, because that basically made Iraq a much more open playing field for the Iranians," said Soli Ozel, a prominent Turkish academic and commentator.
"Inexorably, perhaps unwillingly, Turkey began to find itself a part of the sectarian games as opposed to the position that it very delicately tried to preserve which was being above sectarianism."
Turkish officials have been waging a war of words with Baghdad since December when Shi'ite Iraqi Prime Minister Nouri al-Maliki ordered the arrest of Sunni Vice President Tareq al-Hashemi, based on allegations that he ran death squads.
The row is symptomatic of Turkish anxiety that the country's rising "soft power", based on a booming economy and relative democratic stability ushered in by Erdogan after a long era of military coups, could be threatened by a nascent "Shi'ite axis" embodied by Iran and Maliki's Tehran-backed Baghdad government.
"This is about an escalating power struggle in Baghdad combined with the regional conflict between Iran, Turkey and the Gulf Arab states being played out in Syria and Iraq," said Hasan Turunc, a fellow at Oxford University.
Gulf Arabs and Turkey alike want to see a street uprising and insurgency in Syria unseat President Bashar al-Assad to help roll back the regional clout of his close ally, Iran and prevent any spillover of its increasingly sectarian bloodshed.
Turkey accuses Maliki of sowing sectarian discord by trying to sideline his Sunni rivals - Maliki also called on parliament to remove his Sunni Deputy Prime Minister Saleh al-Mutlaq - and has warned of a regional Shi'ite-Sunni "cold war".
Maliki says it is Ankara that is stirring sectarian tension, calling Turkey a "hostile nation" meddling in Iraq's internal affairs. Erdogan and Maliki have exchanged public insults and both countries have summoned each other's top diplomats over the past few months in tit-for-tat maneuvers.
Compounding tension, Turkish leaders have met publicly with Hashemi, now sheltering in Istanbul after fleeing Iraq in December. Interpol is seeking the arrest of Hashemi, who is being tried in absentia in Iraq. Hashemi denies the charges.
Ankara's aversion to Maliki is not new. For years, Turkey cultivated close links with Sunni groups in Iraq and it supported the Sunni-backed Iraqiya bloc against Maliki in the 2010 parliamentary election.
"Even before the last U.S. soldier was beyond the borders Maliki ordered the arrest of Hashemi, and Turkey took a very strong position. Turkey never really liked Maliki," said Ozel.
Turkey, anxious to protect trade interests in Iraq amid fears that any renewed Iraqi sectarian war could wash over its borders, long strived to encourage a precarious balance between Iraq's Sunni, Shi'ite and Kurdish factions.
This was no better exemplified than by Erdogan's trip to Iraq in March 2011 when he made sure to visit all three centers of power: Baghdad, the Shi'ite stronghold of Najaf, and Arbil, capital of the autonomous Kurdish region in the north.
But that balancing act, analysts say, ended after the U.S. troop withdrawal from Iraq at the end of last year.
Turkey has since publicly received the president of the autonomous Kurdistan Regional Government in Iraq, Masoud Barzani, and Maliki's rival and Iraqiya leader, Ayad Allawi.
For its part, Iran has seen Turkey's shift in orientation in towards its own backyard, a region it once deemed "backward", as a more potent challenge to its aspirations to Middle East predominance than the old, purely pro-Europe Turkey.
As with Iraq, Turkey has traditionally tried to mediate over Iran, particularly Tehran's controversial nuclear ambitions.
But friction between Turkey and Iran has mounted over their backing of opposing sides in Syria's conflagration and Ankara's assent to housing part of a NATO missile defense shield that the United States says is directed against the Islamic Republic.
Some Iranian officials also objected to Turkey playing host to a revival of talks between the six global powers and Iran to head off confrontation over its shadowy nuclear program.
The talks between Iran and Britain, China, France, Germany, Russia and the United States did go ahead in Istanbul in April but not before Erdogan lashed out at Tehran, saying the Iranians "lacked honesty" and were "losing their international prestige".
Sinan Ulgen, a former Turkish diplomat and now chairman of the Centre for Economics and Foreign Policy Studies think-tank, said Erdogan's increasingly strident approach was aggravating strains in ties between Ankara and its neighbors.
"It is his posturing that has led to crises with our neighbors. If he hadn't approached matters in a polarising, black-and-white fashion, we wouldn't have lost the ability to manage these relationships," Ulgen said.
"Instead of being the last person to intervene, very often he is the first to react. What he says then becomes policy, and limits Turkey's room for maneuver; it corners us and policy becomes ossified."
One entity that has profited from this regional power tussle is the semi-autonomous Kurdish region in northern Iraq.
Once branded a "bandit" by Turkey, Barzani has been wooed by Erdogan for the purpose of close relations as Ankara has sought out new allies in a transforming region.
Barzani needs the support of a powerful neighbor that can act as a conduit for its oil supplies. In turn, Turkey is relying on Barzani to clamp down on the militant Kurdistan Workers Party (PKK), which is waging a separatist insurgency in Turkey and whose leadership is based in northern Iraq.
Visiting Turkey last month, Barzani called on the PKK to disarm and said he would not allow any militant group to operate freely in northern Iraq. However, analysts say he is unlikely to bring about any concrete change because of PKK sympathies among many of Barzani's supporters.
Despite strained relations with the Baghdad government, trade with Iraq is booming. Turkey sold more than $8 billion of goods to Iraq last year, making it Turkey's second biggest export market after Germany. According to Turkey's finance minister, about 70 percent of exports to Iraq are to the north.
While some observers say Turkey could stand to lose some state-funded projects in Iraq as relations sour, it is unlikely that trade between Turkey and Iraq will suffer in the long-term.
"Compare it to Turkey's relations with Israel. Turkey and Israel are at odds and there is a lot of public outrage in both countries, however, if you look at economic relations, they are growing," said Oxford University's Turunc.
"Trade and commerce do not necessarily get influenced by the daily political rhetoric and the same can be said for Iraq."
Additional reporting by Simon Cameron-Moore in Istanbul; Editing by Mark Heinrich