Image copyright Reuters Image caption Afghan Sikhs grieved for their relatives near the site of the attack

At least 25 people have been killed in a militant attack on a Sikh temple in the Afghan capital Kabul.

The interior ministry said a gunman had burst into the complex early in the morning, firing on worshippers.

He was killed in an exchange of fire lasting six hours with security forces. Earlier reports said a group of assailants had carried out the attack.

About 150 people were trapped in the complex in the Shorbazar area. The Islamic State group claimed the attack.

IS has targeted Sikhs and other religious minorities before in Afghanistan. The country's main militant group, the Taliban, denied any involvement.

Nato in Afghanistan called it an outrage.

IS is less powerful than the Taliban in Afghanistan and has lost much of the territory it once controlled - but it has not been part of recent negotiations with the US and retains the ability to carry out deadly attacks, reports the BBC's Secunder Kermani.

What do we know about the attack?

About 150 people were inside the temple, which houses families and regularly hosts morning prayers, said Anarkali Kaur Honaryar, a Sikh MP in the Afghan parliament.

People switched off their phones and tried to hide when the attack began, she said.

Image copyright Reuters Image caption Security forces surrounded the scene of the attack

Another Sikh MP, Narender Singh Khalsa, put the number of people inside at 200.

"Three suicide bombers entered a dharamsala [sanctuary area]," he told Reuters. "The gunmen started their attack at a time when the dharamsala was full of worshippers."

Photos from the scene show security forces carrying people away on stretchers.

How vulnerable are Sikhs in Afghanistan?

Afghanistan's dwindling Sikh population, now said to number fewer than 10,000, has long complained of discrimination and harassment by the Muslim majority.

In July 2018, IS said it had bombed a gathering of Sikhs and Hindus in the eastern city of Jalalabad, killing 19 people and injuring 20.

Awtar Singh Khalsa, one of the country's best-known Sikh politicians at the time, was among those killed.