This week's deadly US air strikes on pro-Iranian armed groups in Iraq and Syria sparked fears of a new escalation between the arch-rivals.
Even as they hope to revive a 2015 deal over Iran's nuclear programme scuppered by former US president Donald Trump, are Washington and Tehran risking an explosive new confrontation?
- Why the animosity? -
Iran has bitterly opposed American influence in the region since its 1979 revolution, which toppled the US-backed shah and installed an Islamic republic.
A long-running hostage crisis at the American embassy in Tehran and Washington's support for Iraq in its gruelling eight-year war with Iran cemented their rivalry.
The United States fears Iran could seek to build a nuclear weapon, a charge Tehran denies.
The US-led invasion of Iraq in 2003, which toppled Sunni dictator Saddam Hussein, led to massive Iranian influence in Iraqi politics via Shiite parties and armed groups.
The invasion also sparked years of sectarian violence in the Shiite-majority country, culminating with the rise of the Sunni-extremist Islamic State group in 2014.
IS was defeated by a US-led coalition working with Iraqi forces including the Hashed Al-Shaabi, a paramilitary coalition dominated by pro-Iran groups.
But their uneasy alliance ended with the fall of the IS "caliphate".
Hashed factions have since stepped up demands for a full US withdrawal from Iraq.
- How have tensions spiked? -
Iraqi politicians, trapped between Washington and Tehran, have tried to balance ties with both sides and warned against their country becoming an arena for a violent showdown.
That failed to prevent a major spike in tensions in late 2019, when US raids after the death of a civilian contractor killed 25 pro-Iranian fighters, prompting hundreds of protestors to attack the American embassy in Baghdad.
Then on January 3 last year came the sharpest escalation yet: an American drone strike killed revered Iranian general Qasem Soleimani and the Hashed's former second-in-command Abu Mahdi al-Muhandis near Baghdad airport.
Despite a series of incidents involving the US, Iran and their respective allies elsewhere in the region, the two sides avoided a full-scale military showdown.
But American interests in Iraq continued to be targeted in rocket attacks, blamed on but never claimed by Iran-backed groups.
More recently, Tehran's allies from Iraq to Yemen have taken to using Iranian-made armed drones capable of more accurate, damaging attacks and of breaching US anti-rocket defences.
- What has changed? -
Since replacing Trump, US President Joe Biden has launched indirect talks with Tehran on reviving the nuclear deal -- but he has also ordered strikes, including those overnight into Monday which reportedly killed nine pro-Iranian fighters.
"The Biden administration is trying to restore deterrence by changing its red lines from killing American servicepeople to any escalation against US forces in Iraq, especially sophisticated drone attacks," said Hamdi Malik, a specialist on Iraqi armed groups.
This harder line from Washington has prompted tougher rhetoric from Hashed leaders.
Qais al-Khazali, a senior pro-Iran figure in the Hashed, warned Tuesday that his group's operations had reached "a new stage" and promised to "avenge the precious blood of our youth with the blood of occupying soldiers".
The Iraqi government decried a "a blatant and unacceptable violation" of the country's sovereignty. But within the Hashed many believe that didn't go far enough, instead calling for direct attacks against the "occupier".
Prime Minister Mustafa al-Kadhemi, long seen as Washington's best ally in Iraq, has been increasingly forced to bend to the Hashed's will.
And with elections approaching in October, he appears to be seeking better ties with Iran.
Kadhemi is set to visit Washington soon but was also the first foreign leader invited to Tehran by Iran's incoming president Ebrahim Raisi, on the day of the ultraconservative's mid-June election victory.
- Who wants an escalation? -
While the US, Iran and their allies have all hardened their rhetoric and engaged in shows of force, no side has an interest in a conflagration, observers say.
Washington "took its time to respond" to the deaths of two American contractors in Iraq in a drone operation early this year -- but the Biden adminstration "could opt to escalate", one Western diplomat told AFP.
With the US and Iran engaged in nuclear talks, "it seems that Biden is distinguishing between negotiations in Vienna and Iraqi factions which are trying to exert pressure to give Iran leverage," said Iraqi analyst Ihsan al-Shamari.
Malik said that "while Iran encourages the Iraqi militias to continue with minor attacks against US forces in Iraq, it doesn't want a big war at this stage".
Nor, it seems clear, does the United States, which is now in the process of withdrawing its troops from several theatres, including Afghanistan -- and Iraq.