In the four decades since Iran and Iraq went to war, Tehran has turned enmity into influence, seeing its allies installed in Baghdad's halls of power and becoming its top trading partner.
It's a turn of events Aziz Jaber, a political science professor at Baghdad's Mustansariyah University and a survivor of the conflict, never thought possible.
"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," Jaber told AFP.
Iraqi dictator Saddam Hussein invaded Iran on September 22, 1980, fearing the threat to his rule if Tehran's new clerical rulers tried 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 in Iraq and its military wing, the Badr Corps -- both founded in Iran in 1982.
It nurtured those contacts up to the US-led invasion of Iraq in 2003 -- 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.
"Iran has cunning politicians," Jaber said.
"It did not develop proxies solely for the purpose of war -- it has benefitted from them since they came to power until today."
- Tehran's economic lung -
In Iran, too, the war remains a powerful symbol: medics battling the novel coronavirus this year are likened to "martyrs" who lost their lives fighting Saddam's forces.
The annual parade honouring the war's victims is often used to showcase new weapons including ballistic missiles, while veterans now occupy top military posts in Tehran.
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 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 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.
Soleimani began his military career in the Iran-Iraq war, rising through the ranks to become Tehran's pointman on Iraq. Muhandis served on the same side, as part of Badr.
Their absence slashed Iran's most important nodes of influence in Iraq. Then, in May, Iraq got a new premier.
Mustafa al-Kadhemi and his advisers are seen as less Iran-leaning than their predecessors.
But Tehran isn't panicking, said Chatham House analyst Renad Mansour, as the diverse network it planted early in its war with Iraq would help it weather the current storm.
"Iran cultivated allies in formal political networks but also informal ones -- among militias, businesses, and so on -- to ensure that today's Iraq is one which knows Tehran, and which Tehran knows," Mansour told AFP.
With less influence in the PM's office, Tehran has turned to allies in Iraq's parliament and ministries.
Already, Mansour said, Iran is asking: "Where do we want Iraq in 50 years?"