By Patrick Markey and Suadad al-Salhy
BAGHDAD (Reuters) - Iraq's move to inspect Iranian aircraft flying to Syria may appease the United States but also shows how crisis in Damascus has pushed Prime Minister Nuri al-Maliki into an ever more delicate balancing act between his two main allies.
When he faced a parliamentary revolt this year, he could count on Tehran to pull strings of influence over restive fellow Shi'ite politicians in Iraq's majority community that saw the Iraqis quickly fall in line again behind the Shi'ite premier.
But after the United States complained publicly that Iran was using Iraqi airspace to fly arms and men to help President Bashar al-Assad fight Western-backed rebels, Iraq's government has told Washington it will inspect Iranian flights at random.
Nine years after U.S. forces ousted Iraq's Sunni dictator Saddam Hussein, and nine months after they finally pulled out of the country, Maliki is heavily reliant on Tehran, Washington's enemy. He leans on Iran for political support at home and for backing in a Sunni-dominated region where he has few friends.
But he still needs the Americans, too - for military aid, in part, but also as Iraq seeks global investment and trading access for an oil industry it is struggling to rebuild.
And all the while, with the Syrian civil war inflaming historic confrontations in the Middle East between Sunni and Shi'ite Muslims, and between Arab and Persian, Maliki is trying to carve out space for Iraq's - and his own - interests.
"We are trying to take a independent position, based on our national interests," Foreign Minister Hoshiyar Zebari told Reuters recently in explaining Iraq's Syria policy.
"We are trying to differentiate ourselves. Things are not black and white."
Iraq says it has a policy of non-interference in Syria - but stays close to Tehran's position by refusing to endorse Western and Arab League demands for the removal of Assad, whose Alawite minority faith is an offshoot of Shi'ite Islam.
For Maliki, who once found refuge in Syria and Iran as a Shi'ite Islamist activist fleeing Saddam, a defeat for Assad that put Damascus under the control of Sunni Islamists could add to the threat he already faces from a Sunni insurgency blamed for the kind of attacks that killed over 30 Iraqis on Sunday.
"We reject attempts to bring down the regime by force, because it will leave a wider crisis in the region," Maliki has said.
That concern, rather than any pressure from Tehran, appears to drive the Iraqi premier, diplomats and Iraqi officials say.
"Maliki is fundamentally looking after Maliki's interests," one diplomat involved in the region said.
"Relations with Iran may be part of that. But I don't think Iran's interest will trump Maliki's domestic interests."
Maliki is keenly aware of the benefits of keeping Iran on board. Tehran helped secure his premiership into a second term in 2010 by persuading fractious Shi'ite parties to join forces and outmaneuver Sunnis, Kurds and independent groups.
At the same time, Washington's sway over a leader whom it once saw as more mindful of U.S. interests than other Shi'ite candidates had faded, even before the troop withdrawal. Maliki, aware of nationalist sensitivity, said Iraq could not support a small U.S. force staying on by extending troops' legal immunity.
But Washington still has weight it can pull with Maliki, as the appeasing move on Iranian flights to Syria demonstrated.
"Maliki will never risk his relationship with the U.S.," said Iraqi Shi'ite lawmaker Amir al-Kinani. "But he will send a message saying they must support him to stay in power.
"This has nothing to do with religion, for Maliki or for Iran - it's about interests."
Washington has allowed $2 billion in weapons sales to Iraq in 2012 alone, including a recently completed purchase of U.S.-made tanks. Baghdad will soon take delivery of more than 30 F-16 fighters that will be the backbone of its new air force.
U.S. military officers engaged in training programs also still operate out of the U.S. embassy in Baghdad.
With President Barack Obama campaigning for re-election, some in the United States have suggested pressing Iraq harder to distance itself from Iran. But U.S. diplomats are wary of exerting pressure that might have the opposite effect on Maliki. The State Department rejected a call for aid to Baghdad to be threatened if Iraq did not block Iranian flights to Syria.
"Maliki has a variety of reasons for wanting Assad to stay in power. The fact Iran shares this preference will tend to promote stronger relations," said Stephen Biddle, professor at George Washington University.
"That does not mean Maliki will ignore U.S. preferences.
"He wants help wherever he can get it, and the United States can provide arms of the kind and quality Iranians cannot."
SYRIAN QUESTION MARK
Syria's crisis, and how the increasingly sectarian turmoil develops there, remains a major question mark over how Maliki will manage future relations with Washington and Tehran.
Already Maliki's relationship with Assad is complex.
At the height of the Sunni insurgency in Iraq, Iraqi Shi'ite leaders slammed Damascus for letting foreign militants, including al Qaeda fighters, slip over their desert border. Members of Saddam's Baath party, long estranged from the Syrian wing of the movement led by Assad, also found refuge in Syria.
But Maliki has since developed a more pragmatic relationship with Damascus, not least as the prospect grows of Syria falling to a hardline Sunni revolt that could the reignite Iraq.
How Maliki manages Syria now depends on whether - or how - Assad's regime falls. More Western and Arab intervention in Syria that might ease Assad out in favor of a broad-based Syrian government could be a relief for Baghdad.
But a messy collapse, and the rise of a hostile Sunni regime next door, may drive a threatened Maliki closer to Iran; Tehran in turn may increase its focus on Baghdad if it loses Damascus.
"I suspect the Iranians are going to be very dismayed by the collapse of Syria and the loss of their ally and will redouble their efforts in Iraq," said Kenneth Pollack at the Brookings Institute's Saban Center for Middle East Policy in Washington.
"Both those things are probably going to make it harder for Maliki to chart an independent course."
(Additional reporting by Aseel Kami, Ahmed Rasheed and Raheem Salman in Baghdad; Editing by Alastair Macdonald)