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."