The exchange of gunfire lasted about five hours and the shootings ended around 3 p.m. with the three attackers shot dead.
The ministry released their photographs and first names.
The ministry said the men traveled back to Iran under an ISIS leader's command.
Abu Aisha was killed and the network forced to flee the country, the statement said.
Pope Francis "laments this senseless and grave act of violence", and "assures the people of Iran of his prayers for peace", the message read.
Iran arrests 8 suspected of supporting Tehran attacks
"Repugnant WH (White House) statement and Senate sanctions as Iranians counter terror backed by USA clients".
A few senators pleaded for a delay until next week of the previously scheduled vote in light of the attacks in Iran. "God willing they will be eradicated". However, Behnam Ben Taleblu, a senior Iran analyst at the Washington-based Foundation for Defense of Democracies, criticised the idea that Syria and Iraq could form an effective first line of defence for Iran. Both Iran and the Syrian government portray the Syrian war as a conflict against Western- and Gulf-sponsored terrorism.
It called the detainees "elements of the Wahhabi IS group", and said they were involved in operations, communication and logistics for the local Islamic State group cell. Thousands packed Tehran's streets today to mourn the victims of two suicide bomb and gun attacks, and joined their supreme leader in accusing regional rival Saudi Arabia of involvement in the assaults. Iran also has been fiercely opposed to the militant group.
Despite these remarks, Iranian backed forces are fighting alongside the US-led coalition against Daesh in Iraq.
Writing in the daily Ghanoon, Iranian Foreign Ministry spokesman Bahram Qassemi linked the attacks in Tehran, particularly on parliament, to the May 19 presidential vote, which saw a relatively high turnout.
Rouhani told state TV that "whenever the nation scores a victory, ill-wishers work to deliver a blow to the country and the people", referring to the May 19 presidential election that saw a substantial turnout. Javan also appeared to link the attacks in Tehran to Saudi Arabia while also blaming the United States for supporting the kingdom. He also accused Washington of exchanging democracy for money, referencing a massive arms deal recently agreed between the U.S. and Saudi Arabia. IS claimed responsibility for the assaults, and threatened more against Iran's Shiite majority.
Four armed assailants attacked parliament office buildings on Wednesday morning, while the shrine of revolutionary founder Ruhollah Khomeini was struck by a suicide bomber, state media reported.