Iraq invaded Iran on 22 September 1980, triggering a bitter eight-year war which destabilised the region and devastated both countries.

The then Iraqi leader Saddam Hussein claimed as a reason for the invasion a territorial dispute over the Shatt al-Arab, the waterway which forms the boundary between the two countries.

However, the conflict was rooted in regional rivalry.

Saddam Hussein felt directly threatened by the Islamic revolution which had brought Ayatollah Khomeini to power in Iran the year before.

The ayatollah, for his part, saw Saddam as a brutal Sunni tyrant oppressing his country's Shia majority, and did not disguise his desire to see him toppled.

Thus, for Saddam Hussein, the war's purpose was pre-emptive: to overthrow the Khomeini regime before that regime could overthrow him.

He believed that Iran was in turmoil and that his forces could achieve quick victory.

It was a monumental mistake.

War of attrition

By 1982 Iranian forces had regained the territory they had lost and pushed across the border into Iraq. Khomeini rejected an Iraqi offer of a ceasefire.

IRAN-IRAQ WAR DATES

September 1980Iraqi forces invade Iran

June 1982Iran counterattacks, rejects ceasefire offer

May 1984Iran attacks Gulf shipping, escalating Tanker War

1985Bombing of civilian centres in War of the Cities

July 1987UN resolution 598 calls for ceasefire

July 1988US carrier shoots down Iranian civilian airliner, claiming it thought it was a fighter

August 1988Ceasefire agreed

So although Baghdad had started the war, it was Khomeini who prolonged it.

The conflict turned into a war of attrition, with each side showing a marked disregard for the human cost:

Khomeini sent thousands of young Iranians to their death in "human-wave" attacks.

Saddam used chemical weapons against the Iranians and, in 1988, against his own people - the Kurds of Halabja - whom he considered a treacherous fifth column.

In the "war of the cities", both sides pounded their adversary's civilian population from the air.

In the "war of the tankers", each side attacked oil tankers and merchant ships in the Gulf in a bid to deprive the other of trade.

In fact, the tanker war served to internationalise the conflict.

After repeated Iranian attacks on its vessels, Kuwait appealed to outside powers for protection - and both the United States and the Soviet Union stepped in.

This helped turn the tide against Iran.

Seeing that their country was exhausted and isolated, Iranian officials urged Khomeini to accept a ceasefire.

When he finally did so, in July 1988, he likened it to drinking a cup of poison.

Counting the cost

The economic and political fallout was immense. At least half a million people died, and upper estimates stretch to 1.5 million.

Neither side had achieved its war aims. Khomeini had not overthrown Saddam. Saddam had not overthrown Khomeini or forced him to re-draw the border in Iraq's favour.

Despite massive reverses, Saddam Hussein tried to claim victory

Although the Iraqi leader sought to claim victory, in reality he had merely staved off defeat - and even that had required a good deal of outside help.

Iraq's economic plight was one of the factors that led Saddam to take the fateful decision to invade Kuwait in 1990. And on that occasion the Western and regional powers which had come to his aid in fighting Iran united in opposing him.

For Iran, the consequences were no less dire.

The war not only exacted a heavy human and material cost. It extinguished much of the zeal of the Islamic revolution. It led Iranians to question more sharply the capabilities of their clerical leadership.

With Khomeini's death shortly after the end of the war, the country entered a new and more introspective era.

The Iran-Iraq war left a painful legacy. Few modern conflicts have been so long, so bloody and so futile.