Iran denounced Donald Trump's reaction to deadly Islamic State group attacks in Tehran as "repugnant" on Thursday after the US president warned the nation is reaping what it sows.
Thirteen people were killed and more than 40 wounded in the attacks on Tehran's parliament complex and the shrine of revolutionary leader Ayatollah Ruhollah Khomeini on Wednesday, the first claimed by IS in Iran.
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 six attackers were Iranians who had joined IS, the deputy secretary of Iran's Supreme National Security Council, Reza Seifollahi, said on state TV.
They were armed with rifles and pistols and at least two blew themselves up with suicide vests, Iranian media reported.
Police said five people were arrested around Khomeini's shrine on suspicion of involvement, while the intelligence ministry said a third team had been stopped before the attacks started.
IS has threatened to step up recruitment within Iran, releasing its first Persian-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.
Iran has a sizeable Sunni population along its restive borders with Iraq and Pakistan from which IS is hoping to recruit.
Trump's comments also 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.
Even as Washington expressed its condolences yesterday, 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".
Iranian security officials counter that it is their regional rival Saudi Arabia -- a close US ally -- that is responsible for funding and spreading the extremism that underpins IS.
Iran's Revolutionary Guards accused Riyadh and Washington of being "involved" in yesterday's attacks, drawing a link to Trump's recent visit to Saudi Arabia.
"For these two actions to happen... after this meeting means that the US and Saudi regimes had ordered their stooges to do this," said Mohammad Hossein Nejat, deputy head of the Revolutionary Guards intelligence branch, according to the Fars news agency.
Other 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."
Parliament was in session as the violence unfolded and members were keen to show they were undeterred, continuing with regular business.
President Hassan Rouhani said "terrorism is a global problem, and unity to fight extremism, violence and terrorism with regional and international cooperation is the most important need of today's world."