Saudi Arabia said on Tuesday it has invited Iran’s foreign minister to visit, hinting at the possibility of a thaw between the Gulf’s two biggest, most bitter rivals who are at loggerheads over Syria’s civil war.

Here are some details on the ups and downs of Saudi-Iranian relations over the last three decades:

1979: The Iranian revolution

Saudi Arabia’s rulers watch aghast as Shah Mohammad Reza Pahlavi is toppled by Shiite Muslim clerics seen in Riyadh as determined to export their Islamic Revolution.

1980-1988: Iran-Iraq War

Iranians fume over Saudi support for Iraq during the 1980-88 Iran-Iraq war, in which Baghdad uses chemical weapons.

1987-88: Makkah

Relations between Saudi Arabia and Iran are badly strained in July 1987 when 402 pilgrims, 275 of them Iranian, die during clashes in the Muslim holy city of Makkah. Protesters in Tehran occupy the Saudi embassy and set fire to Kuwait’s embassy. A Saudi diplomat dies in Tehran of wounds sustained when he falls out of an embassy window and Riyadh accuses Tehran of delaying his transfer to a hospital in Saudi Arabia. King Fahd severs ties with Iran in 1988. Relations are restored only in 1991.

1997: Summit

Crown Prince Abdullah visits non-Arab Iran for an Islamic summit in December, becoming the highest-ranking Saudi to do so since the Islamic Revolution.

1999: Better times

King Fahd congratulates President Mohammad Khatami on his election victory in 2001, saying it is an endorsement of his reformist policy. Khatami had worked for rapprochement with Riyadh after winning his first landslide win in 1997. Khatami visits Saudi Arabia, the first such trip since 1979. Better relations are sealed with a security pact in April 2001.

2003-2012: Rise in regional tensions

The 2003 US-led invasion that topples Saddam Hussain in Iraq empowers the country’s Shiite majority and results in a shift in its political alignment towards Iran.

The 2006 war between Israel and Lebanese militant group Hezbollah, which gets funding from Iran, hardens Saudi suspicions that Tehran is creating new regional alliances threatening Saudi interests.

Iran’s disputed nuclear energy programme deepens Saudi fears that Tehran under Khatami’s hardline nationalist successor Mahmoud Ahmadinejad is bent on dominating the Gulf region.

According to a Wikileaks cable, King Abdullah tells his own diplomats in 2008 that he wants the United States to “cut off the head of the snake”.

2011: Arab Spring

Saudi Arabia looks on in horror as pro-democracy uprisings moved eastward from Tunisia and Egypt to the Gulf. Protests in Bahrain are seen as a red line over Iran’s interference.

Saudi Arabia accuses some Shiites in its Eastern Province of cooperating with a foreign state — meaning Iran — to sow dissension, after clashes there.

The US says it has uncovered an Iranian plot to assassinate the Saudi ambassador to Washington. Riyadh said the evidence was overwhelming and Tehran would pay a price. Iran rejects the report as a fabrication aimed at driving a wedge between Tehran and Saudi Arabia.

2011-present: Syrian war, US-Iran thaw

Moderate Hassan Rouhani is elected Iranian president in June 2013 and turns Iran’s hitherto confrontational foreign policy in a conciliatory direction. Iran strikes an interim deal with big powers in November to limit its nuclear activity.

Relations between Iran and most Gulf Arab neighbours improve.

The Gulf Cooperation Council calls in December for good neighbourly relations with Iran based on “non-interference in internal affairs”.

Iranian-Saudi ties remain chilly, complicated by the fact that the two back opposing parties in Syria’s civil war.

Riyadh is a leading supporter of rebels fighting Syrian President Bashar Al Assad, who is a close ally of Tehran.