An assault on the Intercontinental Hotel in the Afghan capital Kabul has ended after more than 12 hours – with all the attackers killed by security forces, officials say.

The Taliban claimed responsibility for the attack, which began late on Saturday, saying five gunmen armed with suicide vests targeted foreigners and Afghan officials.

Interior Ministry spokesman Najib Danish said the last attacker was killed on Sunday afternoon, more than 12 hours after the attack began.

He said the attack killed six people, including a foreigner and a telecommunications official from the western Farah province who was attending a conference.

Six others, including three security forces, were wounded in the attack on the heavily guarded luxury hotel popular with foreigners and Afghan officials.

Taliban spokesman Zabihullah Mujahid said the insurgents initially planned to attack the hotel on Thursday night, but postponed the assault because there was a wedding under way and they wanted to avoid civilian casualties.

The attack unfolded almost six years after Taliban insurgents launched a similar assault on the property, which is not part of the InterContinental chain of worldwide hotels.

The Interior Ministry said a private firm assumed responsibility for securing the hotel around three weeks ago. The ministry says it is investigating how the attackers managed to enter the building.

Afghan security officials confirmed that 34 provincial officials were gathered at the hotel to participate in a conference organised by the Telecommunication Ministry.

A fire broke out at the hotel as the fighting raged, and the sound of explosions could be heard throughout the standoff. Live TV footage showed people trying to escape through windows on the upper stories.

Captain Tom Gresback, spokesman for Nato-led forces, said in a statement that Afghan forces were leading the response efforts. He said that according to initial reports, no foreign troops were hurt in the attack.

Neighbouring Pakistan condemned the “brutal terrorist attack” and called for greater cooperation against militants. Afghanistan and Pakistan routinely accuse each other of failing to combat extremists along their long and porous border.

Afghan forces have struggled to combat the Taliban since the US and Nato formally concluded their combat mission at the end of 2014. They have also had to contend with a growing Islamic State affiliate that has carried out a number of massive attacks in recent years.

In the northern Balkh province, insurgents burst into a home where several members of a local pro-government militia were gathered late on Saturday, leading them outside and killing 18 of them, said Gen. Abdul Razeq Qaderi, the deputy provincial police chief. Among those killed was a tribal leader who served as the local police commander, he said.

In the western Farah province, a roadside bomb killed a deputy provincial police chief and wounded four other police early on Sunday, according to Gen. Mahruf Folad, the provincial police chief.

The Taliban claimed both attacks.

In the western Herat province, a roadside bomb struck a vehicle carrying 13 civilians, killing all but one of them, said Abdul Ahad Walizada, a spokesman for the provincial police chief. No one immediately claimed the attack, but Walizada blamed Taliban insurgents, who often plant roadside bombs to target Afghan security forces.