Two children were among the victims of the Serena Hotel attack in Kabul, officials have said.
Four Taliban fighters snuck into the hotel early on Thursday evening and hid for three hours before storming into the restaurant and opening fire on people inside, according to interior ministry spokesman Sediq Sediqqi.
They then battled Afghan special forces for more than an hour inside the hotel before being overwhelmed, as terrified guests hid in rooms or fled to bunkers inside.
The foreign nationals killed were from Canada, India, New Zealand and Pakistan, the interior ministry said. The victims included four women, three men and two children.
All the guests and staff at the Serena hotel in Kabul, Afghanistan, are safe after gunmen attacked the building, an official claimed.
The Taliban has claimed responsibility for the attack on the luxury hotel which is home to many United Nations staff and foreign delegations who are in the country ahead of next month's presidential election.
Two or three gunmen entered the luxury Serena hotel in Kabul, Afghanistan by a back door and opened fire wounding two people, security sources told Reuters.
One person, who was taken to safety along with other guests, said the shooting appeared to begin in the hotel restaurant. Another guest told the news agency he could hear sporadic gunfire.
The hotel, which was attacked in 2008 by a suicide bomber claiming six lives, is considered the safest place to stay in Kabul and is home to many United Nations staff and foreign delegations ahead of next month's presidential election.
A luxury hotel in the centre of the Afghan capital Kabul, which is home to many United Nations staff and foreign delegations ahead of next month's elections, has been attacked by gunmen, a guest told Reuters.
The woman, who was taken to safety along with other guests, said that the shooting appeared to start in the restaurant at Serena hotel.
An eyewitness told Reuters how the Kabul blast "shook the whole area".
Shkaib Sarwari said: "A suicide attack happened in a Lebanese restaurant, which shook the whole area and then gunfire started. We were very scared and when I came out all I could see was security forces around the area."
Another eyewitness, Gul Agha, told Bloomberg Businessweek that the explosion shattered windows of Norway's and other nearby embassies. The initial blast was so forceful that it was heard miles away.
The Lebanese restaurant, Taverna du Liban, was targeted during a busy time when many of the neighbourhood's Western aid workers, journalists and other expatriates were dining out.
The restaurant was lacking in common security measures, such as cement blast walls and checkpoints blocking off the street.
The bombing was the third in the Afghan capital in under two weeks.