Iran's intelligence minister said the mastermind behind Wednesday's attacks in Tehran, which killed 17 people, had himself been killed on Saturday by security forces.
"The mastermind and main commander of terrorist attacks on the parliament and Mausoleum of Ayatollah Khomeini was killed today by the security forces," Mahmoud Alavi was quoted as saying by Tasnim news agency.
Armed men launched attacks in Iran's parliament and the Mausoleum of Ayatollah Khomeini on Wednesday morning, killing at 17 people in rare twin attacks. The Islamic State group (ISIS) claimed responsibility for the two attacks.
Iran said on Thursday that the terrorists who attacked Tehran on Wednesday were Iranian members of ISIS who had fought in the militants' strongholds in Syria and Iraq—deepening the regional ramifications of the assaults.
Iranian authorities have also arrested seven people it suspects of helping militants involved in attacks, a judiciary official said on Saturday.
Ahmad Fazelian, a provincial judiciary official, said the seven, suspected of "providing support for the terrorist team", were detained in Fardis, about 50 km (31 miles) west of Tehran, the judiciary's online news agency Mizan reported.
On Friday, authorities announced the arrests of 41 suspects in connection with the twin Tehran attacks.
Separately, the head of the judiciary in Fars province said seven people were detained in the southern Larestan area for possible ties to Islamic State, Iran's ISNA news agency reported on Saturday.
Tehran police said the car the attackers used on Wednesday was discovered on Saturday in the city centre.
"The terrorists first went by car to the mausoleum and after dropping two of them off, went to the city centre to attack parliament," the police said in a statement published on state media.
"Fighters from Islamic state attacked Khomeini's shrine and the Iranian parliament in Tehran," the news agency said.
Amaq published a video on Wednesday showing a gunman at the Iranian parliament where an attack has been taking place.
Another attacker was heard on the video saying: "Thank God ... Do you think we will go away?"
Iran's Intelligence Ministry said a third attack had been thwarted. "This morning two terrorist groups attacked the parliament and Imam Khomeini's shrine ... Members of a third group were arrested before being able to carry out any attack," state TV quoted the ministry as saying.
The unusual attacks in Iran's capital, Tehran, prompted the Interior Ministry to call for an urgent security meeting, according to the state-run IRNA news agency.
Four attackers, dressed as women and armed with AK-47 assault rifles, entered parliament's main gate and opened fire. They barricaded themselves in the upper floors of the building and held several people hostage in a standoff that lasted several hours.
All four of the attackers were shot dead by Iranian security forces.
Iranian media reported that eight people were wounded, including a guard who was hit in the leg.
State TV reported that one attacker at the Iranian parliament exploded a suicide vest in the building, but some other news agencies said the explosion might have been caused by grenades thrown by the assailants
During the standoff, an Associated Press reporter saw several police snipers on the rooftops of buildings around the parliament. Shops in the area were shuttered, and gunfire could be heard. Witnesses said the attackers were shooting from the fourth floor of the parliament building down at people in the streets below.
Police helicopters were circling over the parliament building and all mobile phone lines from inside were disconnected. In addition, all entrance and exit gates at parliament were closed, while lawmakers and reporters were ordered to remain in place inside the chamber, where a session had been in progress.
"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.
Iranian TV said parliament had resumed, and broadcast footage of what it said was the opening session proceeding normally.
Targeting shrine for leader of Islamic revolution
In a separate incident about half an hour later, four terrorists, including a suicide bomber, attacked the Mausoleum of Ayatollah Khomeini in southern Tehran, killing a worker and wounding four other people, according to state TV.
Tehran Governor Hossein Hashemi told state broadcaster IRIB that one attacker detonated a suicide vest at the mausoleum, one was killed by the security forces and the rest of the assailants were arrested.
In addition to being lethal, the attack on the shrine of Khomeini is symbolically shocking. As Iran's first Supreme Leader, Khomeini is a towering figure in the country and was its revolutionary leader in the 1979 ouster of the shah.
Sunni extremists, including ISIS, despise Shiite-majority Iran and are at war with Tehran's proxies in Syria and Iraq.
"The atmosphere is tense. It is a blow to (Iranian President) 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.
Rouhani retained power with a landslide victory over candidates supported by the hardline clergy and the Revolutionary Guards Corps (IRGC), the country's most powerful security force in charge of ensuring national security.