Tehran now wields considerable political and economic influence in neighbouring Iraq with some Iraqis deploring that their country was "handed over to Iran".
In the 40 years since Iran and Iraq went to war, the two foes have grown close with Tehran now wielding considerable political and economic power in Baghdad.
Iraqi dictator Saddam Hussein invaded Iran on September 22, 1980, fearing that Tehran's new clerical rulers would try to replicate their 1979 Islamic Revolution in neighbouring Iraq.
Throughout the war, Iran offered safe haven to a range of anti-Saddam groups, from Kurdish figures to the Supreme Council for the Islamic Revolution Iraq and its military wing, the Badr Corps — both founded in Iran in 1982.
It nurtured those contacts meaning it had closer, older ties than Washington did to Saddam's successors.
In the 17 years since, Iran's ancient allies have cycled through Iraq's corridors of power.
Of Iraq's six post-invasion prime ministers, three spent much of the 1980s in Tehran, including Ibrahim al-Jaafari, Nuri al-Maliki and Adel Abdel Mahdi, who resigned last year.
Badr Corps officials still hold top positions in the security forces. Masrour and Nechirvan Barzani, whose families sought refuge from Saddam in Iran, are now respectively the prime minister and president of Iraq's Kurdish region.
"It would have been hard to imagine at the time that this would happen -- that the parties linked to Iran would now hold the reins," Aziz Jaber, a political science professor at Baghdad's Mustansariyah University and a survivor of the conflict, told AFP.
"Iran has cunning politicians," he said, adding that "it did not develop proxies solely for the purpose of war — it has benefitted from them since they came to power until today."
Iran's economic lung
The relationship goes far beyond politics.
While there was no bilateral trade under Saddam, Iranian goods were smuggled into Iraq through the porous 1,600-kilometre (995-mile) border during the 1990s, when Baghdad faced crippling sanctions.
Following Saddam's toppling, normal trade could begin, said Esfandyar Batmanghelidj of Bourse & Bazaar, a news and analysis website supporting business diplomacy with Iran.
"It's the natural order of affairs for two countries that border one another to engage in commerce. You can make a similar argument about Poland and Germany after the horrors of World War II," he told AFP.
As Iraq sought to rebuild following the US-led invasion, cheap construction materials from Iran were an appealing choice. That trade expanded to include food, cars, medicine and now, even electricity imports.
From apricots to painkillers, Iranian goods are sold across Iraq, at lower prices than domestic products.
Iraq is the top destination for Iran's non-hydrocarbon goods, worth $9 billion (€7.7 billion) between March 2019 and March 2020, according to Iran's chamber of commerce.
In July, Iranian President Hassan Rouhani vowed to double that number.
With Iran's economy increasingly strained by US sanctions since 2018, Tehran is relying on Iraq more and more as its economic lung.
"Iranian companies are looking for somewhere full of consumers, as you can't grow your sales in Iran now because things are tough," said Batmanghelidj.
'Handed over to Iran'
Iran's ballooning sway in politics and economics has begun to irk Iraqis.
"Iraqis in government today allowed Iran in. They handed over our country -- its economy, agriculture and security," said Mohammad Abdulamir, a 56-year-old veteran of the war.
"I fought for five years, and was a prisoner of war in Iran for another 10 -- and in the end my country was handed over to Iran," he told AFP.
His frustration is felt by many others and reached a head in October last year, when unprecedented protests broke out in Iraq's capital and south against a ruling class seen as corrupt, inept and subordinate to Tehran.
Months later, a US drone strike on Baghdad killed top Iranian general Qasem Soleimani and senior Iraqi military commander Abu Mahdi al-Muhandis.