BAGHDADBAGHDAD (Reuters) - President Donald Trump's decision to withdraw from the Iranian nuclear deal has cast a shadow over an already fraught election in Iraq, where Tehran and Washington have vied for influence since the U.S.-led invasion toppled Saddam Hussein in 2003.
The removal of a Sunni dictatorship cleared the path for the country's Shi'ite majority, from which the three top contenders for the premiership, including incumbent Haider al-Abadi, are drawn. The outcome of the May 12 ballot is too close to call.
Whoever wins must balance Iraq's interests - and the need to reduce the struggling economy's dependence on oil - with those of the United States and Iran, whose intensifying rivalry makes that more difficult.
Abadi and his main rivals - predecessor Nuri al-Maliki and new challenger Hadi al-Amiri, a hardline militia commander at the head of a powerful paramilitary coalition aligned with Iran - tilt heavily towards Tehran.
With Trump increasing pressure on Iran, its Shi'ite clerical leadership will be even more determined to maintain its patronage in Iraq.
For Iran, Iraq is the most important Arab state, even more than Syria and Lebanon, where it also holds political and military sway. That is because Iran and Iraq share a border and Iraq is positioned in the heart of the Gulf region.
Iraq is also Iran's main route for supplying arms and fighters to Syria, where it has deployed with allied Iraqi and Lebanese Shi'ite militias to back President Bashar al-Assad in the civil war.
One concern for Iraq is the risk of clashes between the 5,000 U.S. troops there and Shi'ite paramilitaries notionally under Baghdad's command but answering to Iran's Revolutionary Guards, and to supreme leader Ayatollah Ali Khamenei.
"The Iraqis are very worried. They don't want Iraq to become a new theater of ... war between Iran and the United States," said one senior Western envoy. "If there is a war between Iran and the United States, part of it will be here."
The U.S. and Iran had found a common enemy in Islamic State, which at one point held about a third of Iraq, mainly in the north and the west.
Its rapid advance owed much to the collapse of Iraq's army, hollowed out by the sectarian policies of the Maliki government.
Many Iraqis attribute the jihadis' subsequent defeat to men like Amiri and the Iranian-trained militias, rather than to U.S.-led coalition forces.
America mainly provided air power, while relying on Kurdish fighters on the ground in both Syria and Iraq.
But while Iran sees Iraq as the most strategically important Arab state, some experts believe Tehran will focus more on Israel and the Syrian battlefield.
The conflict there threatens to draw in Israel. Only hours after Trump's announcement on the Iran nuclear deal it launched air strikes against what it says were Iranian and Hezbollah assets, creeping closer to Israel's borders.
Iranian forces in Syria shelled Israeli army outposts across the Syrian frontier overnight, Israel said, prompting one of the heaviest Israeli strikes in Syria since the war began in 2011.
Iraq's foreign ministry called Trump's decision "hasty and rash", and said Washington's withdrawal from the nuclear accord "goes in the direction of escalation which would bring nothing but destruction and the desolation of war" in the Middle East.
In the worst-case scenario, diplomats in the region said, Iran would target U.S. interests in Iraq as their militias did in 2005 by firing rockets into the U.S. embassy in Baghdad. But Iran might prefer to steer clear of Iraq and use Syria instead.
Iraq's Shi'ite leaders nonetheless face a dilemma about how to balance policy between the United States and Iran.
Some Iraqi leaders, among them Abadi, say they want to steer clear of U.S.-Iranian rivalries.
They would "want to follow the model of non-aligned policies, friends of all", said another Western diplomat.
Others, including Amiri, believe that Iraq's single most important relationship is with Iran, and that they have to reinforce that relationship.
Also important to Iraq is building bridges with the minority Sunni community, although some politicians are wary of Abadi's tentative rapprochement with Sunni Saudi Arabia, nurtured after decades of estrangement.
"Their greatest nightmare is to wake up and have the Sunnis or Arabs undermine their ascendancy and dominance in the system, as happened with Daesh," said the second Western diplomat, referring to Islamic State's advances in 2014.
"They are reminded that Iran will be their ultimate resort when that nightmare happens ... When the (Islamic State) caliphate was declared, they (the Iranians) were the first to come to their rescue, not the U.S. or anybody else."
Iraq's Shi'ites do not want to be dominated by Iran, but Trump's move this week against Tehran may make that harder.
"After (Trump's decision) the question is how do you implement a balanced policy when Iran will use Iraq's airspace to arm its militias in Syria? What will they do?", said the diplomat.
Powerful militias trained, funded and armed by Iran and led by Amiri might answer to Tehran rather than Baghdad.
Iran's Islamic Revolutionary Guard Corps has built Shi'ite militias at the heart of the so-called Popular Mobilisation Forces (PMF) into a structure to rival the Iraqi army and security forces.
It did something similar within Lebanon's Shi'ite Hezbollah movement, which has helped Tehran project military strength across the region.
(Editing by Mike Collett-White)