iran protest
Protesters holding pictures of Shiite cleric Sheikh Nimr al-Nimr are pushed back by Iranian riot police during a demonstration against the execution of Nimr in Saudi Arabia, outside the Saudi Arabian Embassy in Tehran Jan. 3, 2016. REUTERS/Raheb Homavandi/TIMA

Saudi Arabia cut diplomatic relations with Iran on Sunday over the storming of the Saudi embassy in Tehran, in a deepening crisis between the regional adversaries following the kingdom's execution of a prominent Shiite Muslim cleric. Iranian protesters stormed the Saudi Embassy early on Sunday and Shiite Iran's top leader, Ayatollah Ali Khamenei, predicted "divine vengeance" for the execution of Sheikh Nimr al-Nimr, an outspoken opponent of the kingdom's ruling Al Saudi family.

Here are some details on the ups and downs of relations over the last 20 years:

* 1987 - MECCA -- Relations between Saudi Arabia and Iran were strained almost to breaking point in July 1987 when 402 pilgrims, 275 of whom were Iranian, died during clashes in the Muslim holy city of Mecca.

-- Protesters took to the streets of Tehran, occupied the Saudi embassy and set fire to Kuwait's embassy. A Saudi diplomat, Mousa'ad al-Ghamdi, died in Tehran of wounds sustained when he fell out of an embassy window and Riyadh accused Tehran of delaying his transfer to a hospital in Saudi Arabia.

-- Diplomatic relations were severed by Saudi Arabia's King Fahd in April 1988.

* 1999 - BETTER TIMES

-- King Fahd congratulated Iranian President Mohammad Khatami on his election victory in 2001, saying it was an endorsement of his reformist policy. Khatami, a Shi'ite Muslim cleric, worked for rapprochement with Saudi Arabia after winning his first landslide in 1997 and ending two decades of tense relations that followed Iran's 1979 Islamic revolution.

-- Khatami visited Saudi Arabia in 1999 on the first visit by an Iranian president since the revolution. The two countries sealed better relations with a security pact in April 2001.

* 2003 - REGIONAL RIVALRY

-- The invasion that toppled Saddam Hussein in Iraq empowered the country's Shiite majority and resulted in a shift in its political alignment toward Iran.

-- Iran's nuclear energy program deepened Saudi fears that Tehran under Khatami's successor President Mahmoud Ahmadinejad was bent on dominating the Gulf region and boosting its Shi'ite populations.

-- Saudi Arabia told an Iranian envoy in January 2007 that Iran was putting the Gulf in danger, in a reference to the Islamic Republic's conflict with the United States over Iraq and its nuclear program.

* 2011 - ARAB SPRING

-- Saudi Arabia sent troops to help Bahrain quash mass pro-democracy protests, fearing the mostly Shi'ite opposition would align with Iran. The two countries later accused Tehran of fomenting violence against Bahraini police.

-- U.S. diplomatic cables released by WikiLeaks showed Saudi leaders, including King Abdullah, pushing Washington to take a tough stance against Iran over its nuclear program, including the possible use of military force.

-- Saudi Arabia accused some Shiites in its Eastern Province, including Nimr, of cooperating with a foreign state -- meaning Iran -- to sow dissension, after clashes between police and Shiites.

-- Washington said it had uncovered an Iranian plot to assassinate the Saudi ambassador to the United States. Riyadh said the evidence was overwhelming and Tehran would pay a price.

* 2012 - PROXY WARS

-- Saudi Arabia became the main supporter of rebels fighting to topple Iran's ally, President Bashar Assad in Syria. Riyadh accused Assad of "genocide" and Iran of being an "occupying power". Tehran accused Riyadh of backing "terrorism".

-- In March 2015, Saudi Arabia began a military campaign in Yemen to stop the Houthis, allied to Iran, from taking power. Riyadh accused Iran of using the militia to stage a coup d'etat. Tehran said Riyadh's air strikes targeted civilians.

(Compiled by Angus McDowall; Editing by William Maclean and Susan Fenton)