Iran experienced its first major ISIS attack on June 7, as armed men and suicide bombers targeted two symbols of the Islamic Republic in Tehran: Ayatollah Ruhollah Khomeini's mausoleum and the Iranian parliament. At least 12 people are reported to have been killed and 42 wounded.
The Iranian Revolutionary Guards (IRGC), the most powerful force in the country, accused Saudi Arabia for the attacks, saying, "This terrorist attack happened only a week after the meeting between the U.S. president (Donald Trump) and the (Saudi) backward leaders who support terrorists. The fact that Islamic State has claimed responsibility proves that they were involved in the brutal attack," as quoted by Reuters.
IRGC deputy commander Brigadier General Hossein Salami promised "revenge for today's attacks in Tehran, on terrorists, their affiliates and their supporters".
The attack actually took place two weeks after US President Donald Trump's visit to Saudi Arabia. Trump was given a lavish welcome by King Salman bin Abdulaziz Al Saud, despite his claim during the 2016 US presidential campaign that the Saudis had ties to 9/11, "kill women" and "push gays off buildings".
The two nations bonded over an anti-Iran alliance during the visit, irking Tehran. Trump and the House of Saud also signed an arms agreement worth over US$100 billion, and discussed Saudi investments in the US, though the deals have not been finalised.
In a speech to the Arab leaders in Saudi Arabia on May 21, Trump pinpointed Iran as the main party responsible for terrorism in the region. This was a departure from the positions of the previous US administration, including those of former US secretary of state Hilary Clinton, which was revealed in leaked emails.
In an interview with The Atlantic magazine in April 2016, former US president Barack Obama even said that Saudi Arabia should "share" the Middle East with Iran.
Trump's Middle East trip coincided with the May 19 Iranian presidential election and complicated the reelection bid of President Hassan Rouhani, a pragmatist reformer, against conservative cleric Ebrahim Raisi.
The Iranian response to Trump's trip was predictably strong. The Supreme Leader condemned both Trump and the Saudis, calling their arms deal a "multi-billion dollar bribe to America" that cannot help the Saudis reach their regional objectives.
He also highlighted the hypocrisy of the Trump administration in ignoring Iran's democratic election to side with the leaders of a "tribal and backward country".
President Rouhani's response to Trump's Saudi gambit was similar, though softer - and more sarcastic - in tone. He mocked the trip as "just a show with no practical and political value" and argued that real strength comes not from arms but ballot boxes, which, he says, "the poor Saudis have never seen".
Public displays of US-Iran hostility aside, the main facts, actors and challenges in the region remain the same. The US and Iran are backing the same governments in Afghanistan and Iraq, which are, respectively, accusing the Pakistani and Saudi regimes (two American allies) of supporting terrorism and unrest in their countries.
The countries are also both fighting against ISIS in Iraq in a tacit agreement about their shared interest in destroying the group. The latter has now responded with a direct attack on Tehran. But that violence is likely to harden Iranian resolve for fighting ISIS.
Neither the US nor Saudi Arabia are likely to get a major strategic advantage from Trump's recent trip, and the agreements signed with the Saudis cannot benefit the US without the country paying a high price for siding with hardline Saudi strongmen and their intolerant version of Islam.
The US could also potentially become immersed in the region once more, going against Obama's pivot to Asia, for the same reasons it has previously become stuck in Iraq and Afghanistan. Trump needs Arab countries' support to counter Iran, fight terrorism, and address the Israeli-Palestinian conflict. But the same contradictions and challenges that have beset US policies in relation to these issues still exist today.
The connections between the US, Iran and Arab countries also explain why the Russians exhibited such a calm attitude towards Trump's trip. Russia has invested in the region, and is on Iran's side in terms both of Syria and fighting terrorism.
Turkey, a NATO ally, has serious disagreements with US policy in Syria, especially over the Kurdish question and is working on Syria with Iran and Russia. Pakistan is a tough nut to crack for all actors involved, including the US, Iran, and Saudi Arabia. These regional and global actors' interests cannot be dismissed by a meeting between Trump and the Saudis.
Iran also has plans for its other neighbours. It is developing infrastructure with Central Asian countries, such as railways and roads connecting with Azerbaijan. Further, Iran plays an indispensable role in the region for the Chinese New Silk Road initiative.
As for the West, Rouhani's re-election has sent a strong signal. Most EU countries' leaders have congratulated him. And, as multilateral sanctions on Iran were lifted after the 2015 nuclear deal, Rouhani's recent victory was also welcomed by global financial markets.
The question now is not so much about Trump's statements and displays of affection to the House of Saud or the continuation of past arms deals. Rather, analysts must understand how Iran will play its regional and global cards.
How will Iran make use of the tensions within the Arab anti-Iran alliance such as the recent Qatar-Saudi rift?
Will Iran downplay the ISIS attack, as the reaction of its Parliamentary Chairman Ali Larijani seemed to indicate? Or will the event increase regional tensions between Saudi Arabia and Iran as IRGC has promised?
The Saudi minister of defence recently issued a not-very-thinly-veiled threat against Iran, saying, "We will work so that the battle is for them in Iran". If anything, the recent ISIS attack may elevate the Iranian-Saudi rivalry to a new level.