The West's relations with Iraq warmed throughout the war, culminating in military intervention on the Iraqi side.
The West feared the rise of Ayatollah Khomeini's radical Islamism and wanted to prevent an Iranian victory.
The US removed Iraq from its list of nations supporting terrorism in 1982.
Two years later it re-established diplomatic relations, which had been severed since the 1967 Arab-Israeli war.
Iraq's principal arms source was its long-time ally the USSR.
But several western nations, including Britain, France, and the US, also supplied weapons or military equipment to Iraq, and the US shared intelligence with Saddam Hussein's regime.
But the Iran-Contra scandal - revelations that the US had been covertly selling arms to Iran in the hope of securing the release of hostages held in Lebanon - caused friction between the US and Baghdad.
In the closing stages of the war, Iran and Iraq turned their military power on commercial oil tankers in the Gulf to sabotage each others' export profits.
US, British and French warships were sent to the Gulf, where several Kuwaiti tankers facing Iranian attacks were given US flags and military escorts.
As the "tanker war" progressed, the US warships also destroyed a number of Iranian oil platforms and - accidentally, according to Washington - shot down an Iranian airbus carrying 290 civilians.