At least five civilians died and six others were wounded, including three security force members, after a group of insurgents stormed the Intercontinental Hotel in Kabul.
Special forces were lowered by helicopters onto the roof of the landmark hilltop hotel during the night-time siege, interior ministry deputy spokesman Nasrat Rahimi told AFP, adding two attackers had been killed.
There was no immediate claim of responsibility for the latest assault in the war-torn Afghan capital that followed a series of security warnings in recent days to avoid hotels and other locations frequented by foreigners.
It is not clear how many people are still inside the hotel, which was previously attacked by Taliban militants in 2011, or whether any foreigners are among them.
A guest hiding in a room told AFP he could hear gunfire inside the 1960s hotel 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, said 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."
His phone was switched off when AFP tried to contact him again.
Local resident Abdul Sattar said he had spoken by phone to some of his friends who are chefs and waiters at the hotel and are trapped inside.
"Suddenly they 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.
An official at Afghanistan's spy agency told AFP at the beginning of the attack that four assailants were inside the building.
They are "shooting at guests", the National Directorate of Security official said.
Rahimi said the attackers were armed with small weapons and rocket-propelled grenades when they stormed the hotel, which is a popular venue for weddings, conferences and political gatherings.
"Seven wounded people have been taken to hospital," Rahimi said.
"Some other guests have been rescued. We will be able to release casualty figures once the operation ends."
But several hours after the attack started Afghan security spokesmen switched off their mobile phones or refused to answer AFP's calls for an update on casualties.
Afghan media is reporting multiple casualties in the attack, which comes days after a UN Security Council delegation visited Kabul for a close-up view of the conflict.
The fourth floor of the hotel, which boasts several restaurants and an outdoor swimming pool, had been set on fire during the raid, the NDS official said.
The last major attack on a high-end hotel in Kabul was in March 2014 when four teenage gunmen raided the Serena, killing nine people including AFP journalist Sardar Ahmad.
The Intercontinental was previously targeted in June 2011 when a suicide attack claimed by the Taliban killed 21 people, including 10 civilians.
Even before Saturday's attack was over, authorities were questioning how the assailants got past the hotel's security, which was taken over by a private company two weeks ago, interior ministry spokesman Najib Danish told AFP.
"They probably used a back door in the kitchen to enter," he said.
Abdullah Sabet, an official at the communications and information technology ministry, said IT officials from around the country were staying at the hotel ahead of a conference today.
"There were 40 of them in the hotel. We don't know if any of them have been killed or wounded," Sabet said.
Security at the Intercontinental, which is not part of the global InterContinental chain, is relatively lax compared with other luxury hotels in Kabul.
A conference on Afghanistan-China relations was held in one of its function rooms earlier Saturday, attended by the Chinese embassy's political counsellor Zhang Zhixin.
An AFP reporter who attended the conference passed through two vehicle security checkpoints.
At the entrance to the building, there was a physical inspection that could be easily evaded by scaling a low-level barrier and entering the lobby.
Security alerts sent in recent days to foreigners living in the Afghan capital warned that "extremist groups may be planning an attack against hotels in Kabul" as well as public gatherings and other locations "where foreigners are known to congregate".
US State Department spokeswoman Heather Nauert said it was not known if any American citizens had been caught up in the attack.
Security in Kabul has been tightened since May 31 when a massive truck bomb ripped through the diplomatic quarter, killing some 150 people and wounding around 400 others -- mostly civilians. No group has yet claimed that attack.
The Islamic State group has claimed most of the recent attacks in the Afghan capital, but authorities suspect that the Taliban-affiliated Haqqani Network has been involved in at least some of them.
The deadliest of the recent attacks happened at a Shiite cultural centre on December 29 when a suicide bomber blew himself up, killing more than 40 people.