Afghan officials declared that a 12-hour gun battle at Kabul's largest hotel had ended on Sunday after security forces killed four assailants, a siege that left six civilians, including a foreigner, dead, report agencies.
The overnight assault left terrified guests scrambling to escape and parts of the building ablaze.
The Taliban claimed responsibility for the attack on the six-storey Intercontinental Hotel on a hilltop overlooking the Afghan capital. People trapped at the top of the building tied bed sheets together and climbed over balconies to escape the assault.
One lost his grip and fell in dramatic television footage by Afghanistan's Tolo News station, which also showed black smoke and flames billowing from the top of the hotel.
Special forces were lowered by helicopters during the night onto the roof of the landmark 1960s building, with Afghan security forces killing four attackers in the hours-long assault, the interior ministry said.
"Five Afghans and one foreigner have been killed," interior ministry deputy spokesman Nasrat Rahimi told AFP Sunday, adding around 150 people were rescued including more than 40 foreigners.
"The body of the foreigner, a woman, was recovered from the sixth floor as the last attacker was being killed," he added.
An official with Afghanistan's spy agency put the number of wounded at eight, while the interior ministry said six.
Officials said four gunmen burst into the hotel, which is not part of the global InterContinental chain, on Saturday night, opening fire on guests and staff and taking dozens of people hostage.
The Taliban claimed responsibility for the latest assault in the war-torn capital via an email from spokesman Zabiullah Mujahid. The interior ministry had earlier blamed the Taliban-affiliated Haqqani network.
It followed security warnings in recent days to avoid hotels and other locations frequented by foreigners. Kabul has become one of the deadliest places in Afghanistan for civilians, with the Taliban and the Islamic State group both stepping up attacks.
It was not clear how many people had been inside the hotel.
During the siege, a guest hiding in a room said he could hear gunfire inside the building, where dozens of people attending an information technology conference on Sunday were staying.
"I don't know if the attackers are inside the hotel but I can hear gunfire from somewhere near the first floor," the man, who did not want to be named, told AFP by telephone.
"We are hiding in our rooms. I beg the security forces to rescue us as soon as possible before they reach and kill us."
Afghan Telecom regional director Aziz Tayeb, who was attending the IT conference, said he saw the attackers enter the hotel.
Local resident Abdul Sattar said he had spoken by phone to friends who are hotel staff and had been trapped inside.
"Suddenly (militants) attacked the dinner gathering... (then) they broke into the rooms, took some people hostage and they opened fire on some of them," he told AFP.