Iran's Revolutionary Guards say Saudi Arabia was behind twin attacks in Tehran that killed at least 12 people and injured 43.
"This terrorist attack happened only a week after the meeting between the US 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," said the statement, published by Iranian media on Wednesday.
The attacks were the first claimed by the hardline Sunni Muslim militant group in the tightly controlled Shi'ite Muslim Iran.
Earlier the deputy head of Iran's Revolutionary Guards promised retaliation on Islamic State - the militant group that claimed responsibility - and its allies.
"Let there be no doubt that we will take revenge for today's attacks in Tehran, on terrorists, their affiliates and their supporters," Brigadier General Hossein Salami was quoted as saying by state media.
The Revolutionary Guards also said in a statement published on state media that it "has proved in the past that it will take revenge for all innocent blood shed" in Iran.
Attackers dressed as women burst through parliament's main entrance in central Tehran, deputy interior minister Mohammad Hossein Zolfaghari said, according to the semi-official Tasnim news agency.
"One of them was shot dead and another one detonated his suicide vest," he said.
About five hours after the first reports, Iranian news agencies said four people who had attacked parliament were dead and the incident was over.
"I was inside the parliament when shooting happened. Everyone was shocked and scared. I saw two men shooting randomly," said one journalist at the scene, who asked not to be named.
Soon after the assault on parliament, another bomber detonated a suicide vest near the shrine of the Republic's revered founder, Ayatollah Khomeini, a few kilometres south of the city, Zolfaghari said, according to Tasnim.
A second attacker was shot dead, he said.
The Intelligence Ministry said security forces had arrested another "terrorist team" planning a third attack, without giving further details.
The attacks took place less than a month after the re-election of President Hassan Rouhani, a moderate, whose landslide victory defeated candidates supported by the hardline clergy and the Islamic Revolutionary Guard Corps (IRGC), which is responsible for national security.
"The atmosphere is tense. It is a blow to Rouhani. How can four armed men enter the parliament, where a very tight security has always been in place," said a senior official, who asked not to be named.
The Intelligence Ministry called on people to be vigilant and report any suspicious movement.
Despite unconfirmed reports of a hostage situation, state television said parliament had resumed, and broadcast footage of what it said was the opening session proceeding normally.
Attacks are rare in Tehran and other major cities though a Sunni militant group named Jundallah and its splinter group Ansar al Furqan have been waging a deadly insurgency, mostly in more remote areas, for almost a decade.
Last year Iranian authorities said they had foiled a plot by Sunni militants to bomb targets in Tehran and other cities during the Muslim holy month of Ramadan.