Afghan forces have killed gunmen who attacked a Sikh religious complex in the capital, Kabul, ending an hours-long siege that killed 25 people, the Ministry of Interior has said.

The attack on Wednesday was claimed by the ISIL (ISIS) armed group. Earlier, the Taliban armed group denied it was behind the siege that left at least eight others wounded.

More:

Witness Raju Singh Sonny told AFP that a man dressed in a police uniform burst into the temple in central Kabul, shot a guard and started attacking worshippers in the main hall.

"Several other attackers also entered the building and they were going from room to room shooting people," Sonny said.

Later in the day, interior ministry spokesman Tariq Arian said in a message to journalists the operation by the security forces had concluded and all attackers were killed.

Security forces cordoned off the area, located in old Kabul, after gunmen stormed the complex, the government said.

Narindra Singh Khalsa, a parliamentarian from the minority Sikh community, told AP news agency he had been near the Gurdwara - the Sikh place of worship - when the attack happened and ran to the site.

Those killed included a child whose body was brought to a Kabul hospital, emergency services and the hospital said.

Security forces had cordoned off the area, located in old Kabul [Rahmat Gul/ AP Photo ]

Sound of explosions

At a Kabul hospital, Mohan Singh, who was in the Gurdwara at the time of the attack, told AP he first heard the sound of gunshots and dove for cover under a table. Later, he heard the sound of explosions, adding that he believes they were hand grenades. He was injured when parts of the ceiling fell on him.

In photographs shared by the interior ministry, about a dozen children were seen being rushed out of the Gurdwara by Afghan special forces, many of them barefoot and crying.

Khalsa later told Reuters News Agency that many people were still inside the building. "The gunmen started their attack at a time when the Dharamsala was full of worshippers," he said, referring to a sanctuary area in the temple compound.

The SITE Intelligence Group, which tracks activities by armed groups, said ISIL had claimed responsibility for the attack on its Aamaq media arm.

Earlier this month, an affiliate of ISIL attacked a gathering of minority Shia Muslims in Kabul, killing 32 people.

Families of the victims arrive at the site of the attack in Kabul [Mohammad Ismail/Reuters]

Sikhs in Afghanistan

The attack comes a day after the US said it would cut its aid to the Afghan government by $1bn over frustrations that feuding political leaders could not reach an agreement and form a team to negotiate with the Taliban.

US Secretary of State Mike Pompeo visited Kabul on Tuesday in a bid to resolve a standoff between President Ashraf Ghani and his rival Abdullah Abdullah, who also proclaimed himself president following a contested election.

The US and the Taliban signed a deal last month that was supposed to pave the way for talks between the Afghan leadership and the rebels, but with Kabul unable to agree on who is in government, the talks have stalled.

Sikhs, who number fewer than 300 families, have suffered widespread discrimination in the country and have also been targeted by armed groups.

In 2018, a suicide bombing targeting the Sikh community and claimed by ISIL killed more than a dozen people in the eastern city of Jalalabad.

Under Taliban rule in the late 1990s, Sikhs were asked to identify themselves by wearing yellow armbands, but the rule was not enforced.

In recent years, large numbers of Sikhs and Hindus have sought asylum in India, which has a Hindu majority and a large Sikh population.