At least 12 people were killed when six attackers mounted simultaneous gun and suicide bomb assaults on Iran's Parliament building and the tomb of the republic's revolutionary founder, in one of the most audacious assaults to hit Tehran in decades. The targets were highly symbolic.
Sunni-majority Saudi Arabia and Shiite-majority Iran have long had a sectarian feud. The rivals are on opposite sides of violent conflicts in Syria, Yemen and elsewhere, and given the tensions, Iran's implication about the attack isn't a great shock.
The ISIS media wing, Amaq, claimed "fighters with the Islamic State" carried out the assault. It was the first time that ISIS, a Sunni Muslim group fighting Iranian-backed militias in Syria, has claimed responsibility for an attack in Iran, which is predominantly Shiite.
The Islamic Revolutionary Guard Corps vowed revenge for the attack, and tied it to the visit of US President Donald Trump to Saudi Arabia
"World public opinion, especially in Iran, sees the fact that this terrorist act was perpetrated soon after the meeting of the US president with the heads of one of the reactionary regional states that has always supported ... terrorists as to be very meaningful," the statement read, according to Iran's semi-official Fars news agency.
The statement did not explicitly name Saudi Arabia, but the implication was clear. It continued to say that the as ISIS's claim of responsibility for the attacks showed the country's "complicity in this wild move."
Trump issued a written statement saying he felt for Iranian civilians, but the government has itself to blame for the attack.
"We grieve and pray for the innocent victims of the terrorist attacks in Iran, and for the Iranian people, who are going through such challenging times," Trump said. "We underscore that states that sponsor terrorism risk falling victim to the evil they promote."
The Revolutionary Guards' accusation comes at a time of heightened Saudi-Iranian tensions following a regional rift with Qatar.
Saudi Arabia, Bahrain, Egypt and the United Arab Emirates cut ties with Qatar
this week and has blocked several of the country's media outlets. The rift was over comments allegedly made by Qatari Emir Sheikh Tamim Al Hamad Al Thani hailing Iran as an "Islamic power" and criticizing Trump's policy toward Tehran.
The Emir's alleged comments appeared on Qatar's official news agency, but Qatar said the website was hacked and the report fabricated by the culprits.
How the attacks unfolded
The attack shocked Tehran: Until now, Iran has largely escaped the regular assaults launched against other participants in Syria's civil war. In a region plagued by sectarian violence, residents of the capital have lived in a peaceful oasis.
The violence began at about 10 a.m. local time (2 a.m. ET) when gunmen apparently dressed as women stormed the main gate of the Parliament building in central Tehran and opened fire, Deputy Interior Minister Mohammad Hossein Zolfaghari told state television.
The attackers took a number of hostages and at least one detonated a suicide bomb. Sporadic gunfire was heard before Iranian authorities declared the situation under control about four hours later. All four attackers were killed by security forces, Fars reported.
At the same time as the Parliament attack was launched, a shooting spree and suicide bombing targeted the Ayatollah Khomeini mausoleum about 25 kilometers (15 miles) away, on the southern outskirts of the Iranian capital. Fars reported that one person was arrested at the tomb.
Gruesome video footage from inside Iran's Parliament during the attack was published by Amaq and appears to have been filmed on a phone by one of the gunmen.
The video opens by showing a quick shot of a man carrying an assault-style rifle walking out of an office, while a bloodied body of a man lies on the office floor. Shots are then fired either at or near the body, even though it appears the victim is already dead.
Attack is 'minor issue'
Iran's counterterrorism unit said that several "terrorist groups" had entered Tehran, though it did not say where they were from. Members of another group had been apprehended.
The speaker of the Parliament, Ali Larijani, attempted to play down the attack, describing it as a "minor issue."
"As you know, some coward terrorists infiltrated a building ... but they were seriously confronted," he said in a statement.
"This is a minor issue but reveals that the terrorists pursue trouble-making."
The attackers chose symbolically significant targets for their assault. The tomb houses the body of Ayatollah Ruhollah Khomeini, the Islamic Republic's founder and first supreme leader, and it is a popular destination for tourists and pilgrims. He led the revolution that overthrew the Shah in 1979 and was supreme leader for 10 years.
The Parliament, the Islamic Consultative Assembly or Majlis, is Iran's principal legislative body. It has 290 members, including women, and there are representatives of religious minorities including Christians, Zoroastrians and Jews.
Gun ownership is heavily controlled in Iran, raising speculation that the attackers smuggled weapons into the country.
Last major attack in 2010
Iran -- which is more than 90% Shiite -- has been involved in military actions against Sunni terrorist groups such as ISIS, who regard Shiites as apostates, but such terror attacks in the country are rare.
Last year, Iran's government said it thwarted "one of the biggest plots
" by terror groups targeting Tehran and other major cities during the month of Ramadan.
This year's holy month started almost two weeks ago on May 26.
The last major attack in Iran was in 2010 when a Sunni extremist group carried out a suicide attack
against a mosque in Sistan-Baluchistan killing 39 people. Kurdish groups have carried out small scale attacks against Iranian security forces in the north-west of the country.
Correction: Earlier versions of this article mischaracterized how long Saudi Arabia and Iran have had a sectarian feud.