Gunmen stormed the Intercontinental Hotel in Kabul, killing at least five people, including a foreigner.
A 12-hour gunbattle with security forces that continued into Sunday morning as frantic guests tried to escape from fourth and fifth-floor windows.
Six other people, including three from the security forces, were reported wounded and more than 150 people, including 41 foreigners, have been rescued from the hotel, said Interior Ministry spokesman Najib Danish.
The bodies of three attackers were recovered as security forces continued to clear the landmark building, he said.
“For the time being we can only confirm that one foreigner was among those who were killed in the attack,” he added.
“The security forces are going room-by-room to make sure that there are no more attackers in the building,” Mr Danish said.
The Intercontinental Hotel is located on a hilltop in the Bagh-e Bala area of the capital and is heavily guarded because it hosts both Afghan and foreign guests as well as official conferences.
Last night’s attack unfolded almost six years after Taliban insurgents launched a similar assault.
The property 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.
No one has immediately claimed responsibility for the attack, which started around 9 pm (4pm GMT) Saturday.
As the fighting raged, a fire broke out. 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.
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.