'At least 20 dead' as IS gunmen hold siege in packed Kabul mosque

At least 20 people have been killed and 50 wounded after four armed gunmen stormed a mosque in the Afghan capital of Kabul, a hospital official has said.

The attackers held worshippers inside the packed Shiite mosque as hostages for several hours.

Two blew themselves up and the other two were shot dead by Afghan Security Forces, said a police official.

A hospital source said many of the wounded were children, and added that the death toll was likely to rise.

The cleric performing the Friday prayer service is understood to be among the dead while a security guard was confirmed as killed in an explosion outside the building.

Security forces surrounded the mosque after the attack. Credit: Karim Amini

So-called Islamic State claimed responsibility for the attack, which saw women held hostage in the crowded mosque.

Security forces who circled the two-storey building initially held back before advancing, whereupon the attackers set off an explosion.

A Shiite official said the attackers had blocked the door leading to the second floor, where women pray, raising the fears of hostage-taking.

The explosion and gunfire caused panicked scenes outside the mosque. Credit: AP

Witnesses said shots were being fired from the mosque, which is in the north of the city and can house up to 1,000 people, before the brutal assault was declared over.

There have been several attacks in recent weeks against the mosques of Afghanistan's minority Shiites.

So-called Islamic State has vowed to carry out more attacks against the Shiites, who are considered heretics by the Sunni extremists.