Iran's intelligence ministry said on Monday it had arrested 27 members of a "terrorist network" suspected of planning attacks last week to coincide with the Muslim holy month of Ramadan.
The group plotted to "carry out terrorist operations in Tehran and some other important cities," the ministry said in a statement on its website.
"They published pictures in cyberspace threatening the honourable nation of Iran with revenge and murder."
It said the attacks were due to take place last week during the Qadr festival and on Jerusalem Day, held each year in solidarity with the Palestinians.
A large number of weapons and ammunition were confiscated, the ministry added.
Iran is a key target for Sunni jihadists, who see its Shiite majority as apostates. Iran has also directly fought the Islamic State group and Al-Qaeda in Iraq and Syria.
Its Revolutionary Guards said on Sunday they had fought off three attempts by "terrorist groups" to infiltrate from neighbouring Iraq in recent days, leaving several dead.