Suicide bombers and gunmen attacked Iran's parliament and the Mausoleum of Ayatollah Khomeini in Tehran on Wednesday morning, killing at least 12 people in a twin assault at the heart of the Islamic Republic, Iranian officials and media said.

Islamic State claimed responsibility and released a video purporting to show gunmen inside the parliament building and one body, apparently dead, on the floor.

The rare attacks were the first claimed by the hardline Sunni Muslim militant group inside in the tightly controlled Shi'ite Muslim country. Islamic State has regularly threatened Iran, one of the powers leading the fight against the militants' forces in neighbouring Iraq and, beyond that, Syria.

The raids took place at a particularly charged time, after Iran's main regional rival Saudi Arabia and other Sunni powers cut ties with Qatar on Monday, accusing it of backing Tehran and militant groups.

Attackers dressed as women burst through parliament's main entrance in central Tehran, deputy interior minister Mohammad Hossein Zolfaghari said, according to the semi-official Tasnim news agency.

One of them detonated a suicide vest in the parliament, he said. About five hours after the first reports, Iranian news agencies said four people who had attacked parliament were dead and the incident was over.

At least 12 people were killed by the attackers, the head of Iran's emergency department, Pir-Hossein Kolivand, was quoted as saying by state broadcaster IRIB.

"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.

Soon after the assault on parliament, another bomber detonated a suicide vest near the shrine of the Republic's revered founder, Ayatollah Khomeini, a few kilometres south of the city, Zolfaghari said, according to Tasnim. A second attacker was shot dead, he said.

The Intelligence Ministry said security forces had arrested another "terrorist team" planning a third attack, without giving further details.

"I was shopping and suddenly heard shooting," said housewife Maryam Saghari, 36, who lives near parliament.

"People started to run away from the area. I was very scared. I don't want to live in fear," she told Reuters by telephone.