A lone gunman with the so-called Islamic State group has rampaged through a Sikh temple in the heart of Kabul, killing 25 worshippers and wounding eight, Afghanistan's interior ministry says.
The gunman held many of the worshippers hostage for several hours as Afghan special forces, helped by international troops, tried to clear the building. At least one of the dead was a child.
Within hours, IS claimed responsibility for Wednesday's attack.
As the siege ended, the special forces rescued at least 80 worshippers who had been trapped inside the gurdwara, as the gunman lobbed grenades and fired his automatic rifle into the crowd, the ministry said.
Afghan legislator Narindra Singh Khalsa said he had rushed over to help after receiving a call from a worshipper inside the gurdwara telling him of the attack.
About 150 worshippers were inside at the time, he said.
The Site Intelligence Group, which tracks militant postings and groups, said IS had claimed the attack on the group's Aamaq media arm.
In photographs shared by the interior ministry, about a dozen children were seen being rushed out of the gurdwara, many of them barefoot and crying.
As news of the attack broke, Taliban spokesman Zabihullah Mujahed tweeted that the Taliban were not involved. Earlier this month, Afghanistan's IS affiliate struck a gathering of minority Shiite Muslims in Kabul, killing 32 people.
Sikhs have suffered widespread discrimination in the conservative Muslim country and have also been targeted by Islamic extremists.
In recent years, large numbers of Sikhs and Hindus have sought asylum in India, which has a Hindu majority and a large Sikh population.