Iran said Saturday it killed the mastermind behind terror attacks in Tehran this week in which 17 people were killed, the country’s Press TV reported.

Iranian Intelligence Minister Mahmoud Alavi said the man, who remained unidentified, was killed by intelligence forces earlier in the day. He did not provide any more details about the man or the circumstances of his death.

Iranian authorities have arrested as many as 41 people suspected of links to the Islamic State group which claimed the terror attacks on Wednesday, according to the Iranian interior ministry.

Reportedly two guards, 10 government staffers and five civilians were killed in the attacks that simultaneously targeted the country’s parliament and shrine of late founder of the Islamic Republic Ayatollah Ruhollah Khomeini.

Iranian policemen evacuate a child from the parliament building in Tehran during a terror attack, June 7, 2017. (AFP PHOTO / FARS NEWS / OMID VAHABZADEH)

Iranian policemen evacuate a child from the parliament building in Tehran during a terror attack, June 7, 2017. (AFP PHOTO / FARS NEWS / OMID VAHABZADEH)

Supreme leader Ayatollah Ali Khamenei had initially played down the attacks, describing them as “firecrackers” that “will not have the slightest effect on the will of the people.”

Iranian Intelligence Minister Mahmoud Alavi in Tehran, Iran, Tuesday, March 4, 2014 (photo credit: AP/Vahid Salemi)

Iranian Intelligence Minister Mahmoud Alavi in Tehran, Iran, Tuesday, March 4, 2014 (photo credit: AP/Vahid Salemi)

On Friday, however, he turned his wrath for the attacks on the United States and Saudi Arabia, his country’s fiercest rivals.

“Such acts will have no other result than to reinforce hatred for the US government and its agents in the region, like the Saudi (government),” Khamenei wrote in a message of condolence to the families of the dead.

Parliament speaker Ali Larijani also slammed the United States and Saudi Arabia, which he called “a tribal state very far from anything like a democracy.”

He called the US the “international” version of the Islamic State group and said Washington had exchanged democracy for money, a reference to a recent huge arms deal between the US and Saudi Arabia. State TV broadcast the ceremony live.

He said anti-Iranian remarks by Saudi Arabia’s foreign minister and US President Donald Trump are a “matter of disgrace” for them.

IS has long vowed to target Iran because the country had deployed military advisers and support to both Syria and Iraq in their fights against the extremist group.

Agencies contributed to this report.