BAGHDAD - Secretary of State Mike Pompeo's surprise visit to Baghdad this month came after US intelligence showed Iran-backed Shiite militias positioning rockets near bases housing US forces, according to two Iraqi security sources.
He told Iraq's top brass to keep the militias, which are expanding their power in Iraq and now form part of its security apparatus, in check, the sources said. If not, the US would respond with force.
As tensions between Washington and Tehran increase, Iraq finds itself caught between neighbouring Iran, whose regional influence has grown in recent years, and the United States.
"The message from the Americans was clear. They wanted guarantees that Iraq would stop those groups threatening US interests," a senior Iraqi military source with knowledge of Pompeo's trip said.
"They said if the US were attacked on Iraqi soil, it would take action to defend itself without coordinating with Baghdad."
The US State Department declined to comment on the details of Pompeo's discussions. He had said after the trip: "We don't want anyone interfering in their country (Iraq), certainly not by attacking another nation inside of Iraq."
The second Iraqi security source said: "Communications intercepted by the Americans showed some militia groups redeployed to take up suspicious positions, which the Americans considered provocations."
He said the Iraqis were told that any threat from the groups "would be dealt with directly by the Americans with force."
Iraqi Prime Minister Adel Abdul Mahdi on Tuesday told reporters that the Iraqi side had not observed "movements that constitute a threat to any side. We clarified that to the Americans - the government is doing its duty to protect all parties."
Tensions between Washington and Tehran intensified early this month as US President Donald Trump's administration stepped up sanctions pressure by ending waivers for some countries to purchase Iranian oil - part of efforts to roll back the Islamic Republic's expanding regional clout.
It also said last week it was sending additional military forces to the Middle East.
Iraq would struggle to rein in the Iran-backed militias.
The paramilitaries are formally part of Iraq's security forces but operate semi-independently, backed by powerful Iran-allied politicians, and are expanding their economic power.
Spokesmen for two Iran-backed paramilitary groups said there were no plans to target US forces, saying talk of threats was "psychological warfare" by Washington.
The United States says Iran is the biggest threat to peace in the region. It wants to weaken the paramilitaries which have expanded their sway over land stretching to Syria and Lebanon, and for Iraq to decrease dependence on Iranian gas exports.
Iran sees Iraq as an important link to the world in the face of US sanctions, and analysts say the positioning of pro-Iran forces and rockets indicates Tehran is prepared at least to threaten the United States with violence.
The Iraqi security source said US officials discussed with Iraqi officials Iran-backed militia deployed along the Syrian border, where US troops have helped fight Islamic State.
Pompeo said last week: "We've urged the Iraqi government ... to get all of those forces under Iraqi central control."
The groups say they already follow the orders of the Iraqi state and are not planning to target US interests.
"American claims are baseless. It reminds us of the big lie of weapons of mass destruction in Iraq," said Laith al-Athari, a spokesman for the Iran-backed Asaib Ahl al-Haq group, referring to the pretext for the US-led invasion of Iraq in 2003.
The Popular Mobilisation Forces (PMF), the umbrella grouping of mostly Shiite militias, numbers around 150,000 men.
There are currently an estimated 5,200 US troops in Iraq, having peaked at 170,000 in the years following the invasion.
Analysts say the positioning of missiles by militias backed by Iran is likely meant as a symbolic threat to the United States, rather than a real plan to use them.
Professor Toby Dodge of the London School of Economics said Iran has in the past moved such weapons "to slowly ratchet up the heat under America in Iraq when it feels America is seeking to threaten Iran's interests."
Some observers say economic pressure on Iran will have more impact than military action.
Pompeo said he discussed on his Baghdad visit "crude oil and natural gas ... (and) ways we could ... make those projects move forward very quickly," a reference to efforts to wean Iraq off crucial Iranian energy imports.
He urged Iraq to sign oil and power deals being negotiated with American companies, two energy officials said.
US energy giant General Electric is seeking a share of a $14 billion scheme to develop electricity infrastructure, and Iraq is close to signing a $53 billion oil infrastructure contract which includes Exxon Mobil.
This is another way in which the United States is seeking to pressure Iraq's major electricity supplier Iran and force Iraq to choose between Washington and Tehran as its chief ally, said Renad Mansour, a research fellow at Chatham House.
"The US is ... going to Iraqi leaders and saying you're either with us or with them," Mansour said.
"Iraqis have been saying why can't we be allies with both? But the Americans aren't interested in that and I think neither are the Iranians."
A Western diplomat said warned of the danger of a serious escalation.
"The atmosphere is no longer friendly ... (and) the White House does not seem to be concerned if Iraq is collateral damage," the diplomat said.