At least 19 people were killed during a 13 hour siege after Taliban gunmen in army uniforms stormed a luxury Kabul hotel popular with Afghan officials and foreigners.
Eyewitnesses described how the gunmen deliberately targeted foreigners as they rampaged through the six-floor Intercontinental Hotel.
One Afghan man told the BBC that he was spared by militants who shouted "Where are the foreigners?" as they ran into the hotel's restaurant at around 9pm local time on Saturday night.
At least 14 of the dead were believed to be foreign nationals, among them two Venezuelans and six Ukrainians.
The gun battle ended on Sunday morning as Afghan special forces killed the last of the six gunmen, who were armed with grenades, automatic weapons and suicide vests.
By 10am, Special Forces could be seen sweeping the roof of the hotel as firefighters attempted to extinguish a blaze which had ripped through the sixth floor.
Thick clouds of black smoke could be seen pouring from the building, an imposing 1960s structure set on a hilltop.
Some 150 desperate staff and guests managed to escape the building throughout the night, amid heavy gunfire and explosions. One witness told AFP that the hotel's security team fled "without a fight".
Dramatic footage showed people clambering down from upper-floor balconies using bedsheets tied together.
Telecoms executive Aziz Tayeb posted a desperate plea on Facebook from a hiding place behind a pillar as attackers sprayed guests and staff with bullets: "Pray for me. I may die."
Mr Tayeb was at the hotel for a major IT conference set to take place yesterday.
Abdul Rahman Naseri, also at the hotel for the conference, described how he saw four gunmen dressed in army uniforms.
"They were shouting in Pashto, 'Don't leave any of them alive, good or bad'. 'Shoot and kill them all,’ one of them shouted," Mr Naseri said.
"I ran to my room on the second floor. I opened the window and tried to get out using a tree but the branch broke and I fell to the ground. I hurt my back and broke a leg."
The attackers are believed to have got into the hotel via the kitchen, and a worker in the restaurant said the men had sat down and ordered food, before opening fire.
"They were wearing very stylish clothes," the man, named as Haseeb, told Tolo News. "They came to me and asked for food. I served them the food and they thanked me and took their seats. Then they took out their weapons and started shooting the people."
A senior security official said that the attackers had moved directly from the first floor to the fourth and fifth floors, suggesting the attack had been carefully prepared, possibly with inside help.
"When the sixth floor caught fire this morning, my roommate told me, either burn or escape," said Mohammad Musa, who was hiding in his room on the top floor.
"I got a bed sheet and tied it to the balcony. I tried to come down but I was heavy and my arms were not strong enough. I fell down and injured my shoulder and leg.""There were dozens of dead bodies lying around me."
Wahid Majroh, a spokesman for the ministry of public health, last night said 19 bodies had been brought into the city's hospitals, but a senior Afghan security official said the death toll was over 30 and might climb higher.
At least 11 of the dead worked for private Afghan airline Kam Air, which on Sunday suspended domestic flights. It said a further 14 emloyees were still missing.
Also among the dead was Dr Abdullah Waheed Poyan, a well-respected academic who had worked for the Afghan diplomatic corps.
Interior ministry spokesman Najib Danesh said a private company had taken over responsibility for security at the hotel three weeks ago and there would be an investigation into possible failings, just days after a US embassy warning of possible attacks on hotels in Kabul.
The raid was the latest in a series of attacks that have underlined the city's vulnerability and the ability of militants to mount high-profile operations aimed at undermining confidence in the Western-backed government.
The Taliban, which attacked the same hotel in 2011, claimed responsibility for the attack, its spokesman Zabihullah Mujahid said in a statement.