A suicide bomb and gun attack claimed by ISIL killed 12 people and wounded scores more at a Shiite mosque in Afghanistan's capital on Friday, in the latest assault to highlight deteriorating security in the country.
Gunshots and explosions were heard during the attack that lasted around four hours at a mosque in a residential area in north Kabul.
The mosque was believed to have been packed with dozens of men, women and children when the assailants struck during Friday prayers. Witnesses reported seeing worshippers smash windows to escape.
Heavily-armed security forces surrounded the building and managed to rescue more than 100 people, according to the interior ministry.
It said 10 civilians were killed and more than 40 wounded. Among the security forces, two were killed and seven others wounded.
Deputy spokesman Najib Danish said three attackers were killed by security forces.
"The attack is over and the site has been cleaned up by our police," he said.
Kabul police spokesman Abdul Basir Mujahid said a suicide bomber "detonated himself inside the mosque".
Some witnesses described horrific scenes inside the mosque as the attackers ran short of bullets and began "using knives to stab worshippers". Others said the attackers had been armed with rocket propelled grenade launchers.
People gathered outside the mosque had tried to call women and children trapped inside but they did not answer their phones.
"Our relatives have been stranded inside the mosque … We believe they have been held hostage by the gunmen. We are very concerned about their safety and may God help us and rescue our loved ones," said one.
ISIL claimed responsibility for the assault via its propaganda agency.
"Two 'inghimasi' of the Islamic State carried out an attack on a husseiniya [Shiite place of worship] in the Khair Khana sector of the Afghan city of Kabul," Amaq said, using the term for suicide bombers who set off explosive vests as a last resort against gunfire.
The assault underscores spiralling insecurity in Afghanistan as a resurgent Taliban steps up offensives across the country, while ISIL, known for carrying out sectarian attacks, expands its Afghan footprint.
It comes just days after US president Donald Trump cleared the way for thousands more American troops to be deployed in the war-torn country.
More than 10 ambulances were at the scene to take the wounded to local hospitals. Some relatives flocked to a nearby private hospital to search for loved ones who had been in the mosque at the time of the attack.
Pools of blood could be seen at the entrance to the medical facility.
Shiites, a minority of about three million in overwhelmingly Sunni Afghanistan, have been targeted regularly by ISIL. They accuse police and troops of failing to protect them.
ISIL claimed responsibility for a series of attacks killing dozens of Shiites in Kabul over the past year, including twin explosions in July 2016 that ripped through crowds of Shiite Hazaras, killing at least 85 people and wounding more than 400.
Earlier this month 33 worshippers were killed and 66 wounded in a suicide attack claimed by ISIL on a Shiite mosque in the western Afghan city of Herat.
Trump's Afghanistan strategy receives praise
Mix of hope and scepticism among war-weary Afghans
Afghanistan's juvenile justice system needs reform