* Turkish PM Erdogan virtually silent over Iraq
* Analysts say Ankara wary after Syria travails
* Government says Iraq warnings weren't heeded
* Kurds eyeing independence could benefit
By Jonny Hogg
ANKARA, July 4 (Reuters) - As al Qaeda-inspired Sunni militants spread right along Turkey's southeastern border last month from Syria through Iraq, seizing Turkish hostages as they went, the normally loquacious Prime Minister Tayyip Erdogan had little to say.
Turkey's outspoken opposition to the crackdown in Syria gained it global headlines as it opened its border and poured aid across to help refugees and rebels alike. But three years later the situation has morphed into a security and humanitarian nightmare on Ankara's doorstep, that has now spread to Iraq.
The Sunni militant advance and hostage crisis there is overshadowing Erdogan's campaign to become Turkey's first elected president in a vote due next month.
His response has been muted, shorn of the bombastic rhetoric or global calls to action employed in previous regional crises, a sign of a newly tentative regional policy which could have wide repercussions.
Stopping short of calling the militants terrorists, he said only that air strikes against them should be avoided.
"Turkey now has security concerns it didn't have two years ago, therefore its own security is the number one foreign policy aim, rather than transforming the region," said Ozgur Unluhisarcikli of the German Marshall Fund.
Recent pronouncements on Syria, where Erdogan previously led calls for military intervention when it cracked down on Sunni protesters in 2011, have been similarly muted, as has his once-scathing criticism of the military in Egypt which ousted an Islamist elected president last year.
While a foreign policy pullback may ease some of the tensions that have built up, it could also mean a dangerous limbo at a time when Turkey's security is increasingly threatened by the gaping power vacuums opening up on its south-eastern borders.
After he came to power in 2003, Erdogan bolstered Turkey's influence, maintaining warm relations with neighbours as its traders poured into Egypt and post-conflict Iraq, whilst winning plaudits as a model for the region of a democratically-elected, moderate Islamist government.
Many analysts say a more inward-looking Turkey would be a serious loss to regional stability, although some say Erdogan, a devout Sunni, had long since undermined the positive impact of his early foreign policy with a Sunni bias.
Erdogan and his allies deny sectarianism, instead blaming the outside world for turning a blind eye to abuses by the leaders of both Syria and Iraq.
The kidnapping of 80 Turkish nationals, including the consul-general, when militants from the Islamic State of Iraq and the Levant (ISIL), since renamed the Islamic State, seized Iraq's second city of Mosul on June 10, has left Erdogan exposed as he campaigns for the presidency.
The government has imposed a media blackout on the hostage standoff but has been unable to duck fierce criticism over it, prompting Erdogan to accuse the opposition of wanting "the 80 Turks to come to harm so they can (lambast) the government."
On Thursday, 32 truck drivers were released but diplomats and government sources say the other hostages, who are thought to be unharmed, are being used as human shields to keep Ankara at arms length as the militants push on towards the Iraqi capital.
"Turkey's influence on the internal dynamics of Iraq right now is extremely limited; they can't make any significant moves," Osman Bahadir Dincer, Middle East expert at the Turkey-based, International Strategic Research Organisation (USAK) think tank.
This week Deputy Prime Minister Bulent Arinc said the government hopes to have the captives freed within a month. Even if this happens, Ankara's behaviour is likely to remain cautious as the region continues to fragment.
Ankara's softly-softly approach to the Iraq crisis marks the end of a period in which analysts say ideology trumped pragmatism and Erdogan's desire to appear powerful to his largely Sunni conservative voter base saw a toxic mixing of foreign and domestic policy.
A "zero problems with neighbours" policy had crumbled and was replaced by degraded relations with Egypt, Syria, Israel, Iraq and Iran, as well as U.S. and European partners.
Turkey's ambassador to Iraq between 2007 and 2011 says Ankara has been sucked into a semi-sectarian rivalry with Iran and has, in the process, lost its reputation as a non-partisan force for good within the region.
"Three years ago Turkey was considered a wonderful regional power working inside Iraq using its soft power. All of our brothers in the Middle East were looking up to us," Murat Ozcelik told a briefing in Ankara.
Increasingly strained relations with Iraq's Shi'ia-dominated government of Nouri al-Maliki, coupled with allegations Turkey has backed militant Sunni groups in neighbouring Syria, have fuelled suspicions Erdogan has abandoned traditional Turkish foreign-policy principles of secularism, democracy and trade, Ozcelik said.
"If we can manage to come (back) to the centre ... there's no reason why we cannot again become friends of the Shi'ia and be respected in the region. At the moment I don't think Turkey has much influence to shape events in a positive sense, in Iraq or in the region."
Turkish officials deny backing extremist groups and express frustration at what they say is the failure of international and regional actors to heed their mounting criticism over worsening relations between Maliki's government and the Sunni population in Iraq.
"We warned repeatedly that the exclusionary policies used against Sunnis ... could lead to a large explosion of violence. Now no one can control this, Turkey cannot control this, and neither can Iran. A wave of uncontrollable violence has blanketed the region," Yasin Aktay, vice-chairman of the ruling AK Party, told Reuters.
Ankara's sense of frustration and abandonment by the U.S. and other western allies - a regular theme in foreign-policy speeches - makes Turkey even less likely to take a lead in tackling regional instability, according to Sinan Ulgen, head of Istanbul-based Centre for Economic and Foreign Policy Studies.
"It's certainly to the detriment of the region that Turkey is pulling back, but a lot of that pullback is due to congressional politics in Washington," Ulgen said.
RETURN TO REALPOLITIK
Analysts say Turkey's mounting internal challenges - elections, a faltering economy and growing polarisation - mean a return to the realpolitik of the ruling AK Party's early years.
"The government doesn't have the luxury to be active in the region (anymore). Erdogan is more concerned with his presidential designs than the fate of Assad," said Cengiz Aktar, a senior scholar at the Istanbul Policy Center.
One Turkey-based diplomat sees a return to the pragmatic, money-driven approach to foreign policy which marked the beginning of Erdogan's premiership and saw Turkish businesses booming in the region, especially in post-conflict Iraq.
"What are Turkish interests now? Prosperity, cheap energy, and no terrorism on their territory, so perhaps it's a case of anything to achieve that, even if it's distasteful, is ok," the diplomat said, asking not to be named.
Such pragmatism is not without challenges. One potentially tricky issue is whether Turkey would tolerate, or possibly back, an independent Kurdish state in northern Iraq, with even government officials appearing to give contradictory statements.
Having wrestled with a decades-long separatist Kurdish uprising within its own borders that killed 40,000 people until Erdogan negotiated a ceasefire last year, Turkey could find a fully independent Iraqi Kurdistan fraught with danger.
But Ankara has in recent years enjoyed ever closer relations with the semi-autonomous Kurdistan Regional Government (KRG), signing billions of dollars worth of energy deals to cement one of the few bright spots in its regional policy.
"They might be encouraged to acquire more autonomy, if not independence, knowing that Ankara is agnostic to the idea, and wouldn't try to actively stop it," Ulgen said.
"From the perspective of ISIL, Turkey's less interventionist and aggressive stance (in Iraq and Syria) is certainly a boon."
A more docile role might leave it less exposed to damaging rifts with neighbours and will likely chime well with voters who have little stomach for further regional adventures.
But with events unfolding at dizzying speed, Turkey may struggle to adapt to changing realities, warns USAK's Dincer.
"We are talking about a war zone all along Turkey's southern borders. Everything is getting more complicated for Turkey day by day, and even the decision makers don't have real plans," he said. "They're in limbo." (Additional reporting by Humeyra Pamuk and Ayla Jean Yackley in Istanbul; editing by Philippa Fletcher)