DUBAI: The militant group Islamic State said it carried out an attack on a Shi'ite Muslim shrine in Iran on Wednesday which killed 15 people, escalating tensions in a country reeling from a wave of protests and prompting warnings of a response from Tehran.

Iranian officials said they had arrested a gunman who carried out the attack at the Shah Cheragh shrine in the city of Shiraz. State media blamed "takfiri terrorists" - a label Tehran uses for hardline Sunni Muslim militants like Islamic State.

The group has claimed previous attacks in Iran, including deadly twin bombings in 2017 which targeted Iran's parliament and the tomb of the Islamic Republic's founder Ayatollah Ruhollah Khomeini.

Wednesday's killing of Shi'ite pilgrims came on the same day that Iranian security forces clashed with increasingly strident protesters marking the 40-day anniversary since the death in police custody of Mahsa Amini, a 22-year-old Kurdish woman.

Interior Minister Ahmad Vahidi blamed the protests sweeping Iran for paving the ground for the Shiraz attack, and President Ebrahim Raisi said Iran would respond, according to state media.

"Experience shows that Iran's enemies, after failing to create a split in the nation's united ranks, take revenge through violence and terror," said Raisi, speaking before Islamic State released its claim of responsibility.

"This crime will definitely not go unanswered, and the security and law enforcement forces will teach a lesson to those who designed and carried out the attack."

The semi-official Tasnim news agency said the attacker shot an employee at the shrine entrance before his rifle jammed and he was chased by bystanders.

He managed to fix his gun and opened fire on his pursuers, before entering a courtyard and shooting worshippers. Several women and children were among the dead, it said.

A witness at Shah Cheragh told state television: "I heard sounds of gunfire after we prayed. We went to a room next to the shrine, this lowlife came and fired a barrage of shots. Then (the bullet) hit my arm and leg, it hit my wife's back, but thank God my child was not hit, he is seven years old."

DAY OF CLASHES

The attack in Shiraz took place at the end of a day of confrontations across the country between security forces and protesters, with video footage showing some of the most violent clashes in more than a month of unrest following Amini's death.

The demonstrations have become one of the boldest challenges to the clerical leadership since the 1979 revolution. A wide range of Iranians have come out on to the streets, with some calling for the downfall of the Islamic Republic and the death of Supreme Leader Ayatollah Ali Khamenei.

Security forces opened fire at mourners in Amini's Kurdish home town of Saqez on Wednesday, according to a witness.

"Riot police shot mourners who gathered at the cemetery for Mahsa's memorial ceremony ... dozens have been arrested," the witness said. Iranian authorities were not available to comment.

The semi-official ISNA news agency said about 10,000 people were at the cemetery, adding that the internet was cut off after clashes between security forces and people there.

Videos on social media showed crowds packing streets in many cities and the bazaars of Tehran and some other cities shut down with people chanting "Death to Khamenei".

1500tasvir, a Twitter account focused on Iran protests with 280,000 followers, reported a "brutal crackdown" on protesters in multiple locations in Tehran, including a gathering at the Tehran Medical Association.

Video footage on social media appeared to show members of the Basij militia shooting at protesters in Tehran.

Other videos showed protesters chasing riot police and throwing stones. They also showed protesters in the holy Shi'ite city of Mashhad setting fire to a riot policeman's motorbike. In Tehran, a protester hit a policeman, while in the city of Qazvin riot police opened fire on protesters.

Some protesters chanted: "We will fight, we will die, we will get Iran back" from its clerical rulers.

Reuters was not able to verify the authenticity of the footage.

State news agency IRNA said a member of the elite Revolutionary Guards was shot dead "by rioters" in the western city of Malayer.

An Iranian former pro-reform official said the spread of the protests appeared to have taken authorities by surprise and contrasted with the establishment's assertions that support for the Islamic system is overwhelming.

While some analysts said prospects for the imminent dawn of a new political order are slim, activists said a wall of fear had fallen and the path to a new revolution was not reversible.

Students have played a pivotal role in the protests, with dozens of universities on strike. Hundreds of schoolgirls have joined in, chanting "Freedom, Freedom, Freedom," despite fierce crackdowns by security forces.

State media and hardline officials have branded protesters "hypocrites, monarchists, thugs and seditionists".

Rights groups said at least 250 protesters had been killed, including teenage girls, and thousands had been arrested.

The authorities, who have accused the United States and other Western countries of fomenting what they call "riots", have yet to announce a death toll but state media have said around 30 members of the security forces have been killed.