KABUL - Thirteen people were killed before a long siege was ended at a popular hotel outside the Afghan capital, during which Taliban gunmen took scores of hostages, another bold attack that showed a potent insurgency remains after more than a decade of war.

Five militants armed with rocket-propelled grenades, suicide bomb vests and machine guns attacked the exclusive, lakeside hotel around midnight on Thursday, bursting into a party and shooting dead hotel guards.

Kabul police chief Ayoub Salangi said on Friday four civilians, three hotel guards and a policeman were killed in the 12-hour gunbattle at the Spozhmai hotel, overlooking Qargha Lake. All five attackers were also killed.

The attack, quickly claimed by the Afghan Taliban, again showed the ability of insurgents to stage high-profile raids even as NATO nations prepare to withdraw most of their combat troops by the end of 2014 and leave Afghans to lead the fight.

Many terrified guests jumped into the lake in the darkness to escape the carnage, Afghan officials and residents said. Up to 300 people had been inside the hotel when the attack began.

"Insurgent Taliban were using civilians as human shields to protect themselves, and even this morning around 50 locals were still held as hostages," Sediq Sediqqi, a spokesman for the Afghan Interior Ministry, told reporters.

Earlier, elite Afghan quick-response police backed by NATO troops freed at least 35 hostages in an operation that only began in earnest after sunrise to help security forces avoid civilian deaths in night-time confusion.

NATO attack helicopters could be seen over the single-story hotel building and a balcony popular with guests for its sunset views, while a pall of smoke rose into air.

The Taliban complained wealthy Afghans and foreigners used the hotel, about 10 km (6 miles) from the center of Kabul, for "prostitution" and "wild parties" ahead of the Friday religious day holiday.

Launching their annual offensive this spring, the Taliban threatened to attack more government officials and rich Afghans, but the hotel assault was one of few in which multiple hostages were taken since the start of the war, now in its 11th year.