Iran said Thursday that the five Iranians who killed 17 people in twin attacks in Tehran were Islamic State group members who had been to its strongholds in Iraq and Syria.
The attacks on Wednesday at Tehran's parliament complex and the shrine of revolutionary leader Ayatollah Ruhollah Khomeini wounded more than 50 people and were the first claimed by IS in Iran.
"The five known terrorists... after joining the Daesh (IS) terrorist group, left the country and participated in crimes carried out by this terrorist group in Mosul and Raqqa," the ministry said in a statement.
It suggested there were only five attackers rather than the six originally reported.
The ministry released their photographs and first names, and said they were part of a network that entered Iran in July-August 2016 under the leadership of "high-ranking Daesh commander" Abu Aisha intending to carry out "terrorist operations in religious cities".
Abu Aisha was killed and the network forced to flee the country, the statement said. It was not clear when the five men returned to Iran ahead of Wednesday's attacks.
Iran denounced Donald Trump's reaction to the attacks as "repugnant" after the US president said the nation was reaping what it sowed.
Trump said the US would "grieve and pray" for the victims, but added: "We underscore that states that sponsor terrorism risk falling victim to the evil they promote."
That was condemned by Iranian Foreign Minister Mohammad Javad Zarif, who tweeted: "Repugnant WH (White House) statement... as Iranians counter terror backed by US clients."
The attackers were armed with rifles and pistols and at least two blew themselves up with suicide vests, Iranian media reported.
Police said a further five people were arrested around Khomeini's shrine on suspicion of involvement.
In the midst of the unfolding attacks, the intelligence ministry said a third team had been stopped before the attacks started, but no further details have since been given.
"The network of this terrorist group has been identified and some of its members have been arrested," Intelligence Minister Mahmoud Alavi said.
"We still cannot judge that Saudi Arabia has had a role in this terrorist incident," he added.
Iran's elite Revolutionary Guards have pointed the finger at regional rival Saudi Arabia - a close US ally - which Iran accuses of funding extremism and groups including IS.
IS has threatened to step up recruitment within Iran, releasing its first Farsi-language video in March in which it threatened to "conquer Iran and restore it to the Sunni Muslim nation as it was before."
The Sunni jihadists of IS consider Shiite Iran to be apostates, and Tehran is deeply involved in fighting the group in both Syria and Iraq.
Trump's comments brought criticism from Iranians on social media, who recalled their government's offers of support and the candlelight vigils held in Iran after the attacks of September 11, 2001 in the United States.
"Iranians lit candles for you on 9/11. You kick them while they're down. Classy," tweeted Ali Ghezelbash, an Iranian business analyst.
The US president has long accused Iran of backing terrorism and has threatened to tear up a 2015 nuclear deal between Tehran and major powers.
Trump's statement is "counter-productive and further narrows the opportunity for engagement between the US and Iran on countering a common enemy," said Ellie Geranmayeh, senior fellow with the European Council on Foreign Relations.
Even as Washington expressed its condolences on Wednesday, the US Senate advanced legislation that would impose new sanctions on Iran, partly for what the bill described as the Iranian regime's "support for acts of international terrorism".
Sunni Gulf Arab states are in the midst of a major diplomatic crisis after Saudi Arabia and its allies cut ties with Qatar on Monday over claims it supports extremism and has fewer tensions with Iran.
Iranian leaders sought to play down the attacks, with supreme leader Ayatollah Ali Khamenei saying: "These firecrackers that happened today will not have the slightest effect on the will of the people."