Nine people have been killed in an attack at a luxury hotel in the Afghan capital, including four foreigners and two children who were shot in the head.

Kabul has been hit by several attacks, but authorities appeared stunned that the militants had managed to get through the tight security at the Serena hotel -considered one of the safest places to stay in the city.

The shooting spree was the latest in a series of high-profile attacks as the Taliban and allied militants step up a campaign of violence in the weeks leading to April 5 national elections.

The presidential vote will be the first democratic transfer of power since the 2001 US-led invasion that ousted the Islamic militant movement. President Hamid Karzai is constitutionally barred from seeking a third term.

A Taliban spokesman claimed responsibility for the attack, and said it showed "our people, if they decide to attack any place, they can do it".

The restaurant was packed with Afghans celebrating the eve of the Persian new year, Nowruz, as well as foreigners who frequent the hotel.

Meanwhile, three people have been killed in an explosion during a ceremony marking Nowruz in Kandahar, Afghan officials said.

Police said militants threw a bottle packed with explosives, which blew up when it hit the ground. The dead included the head of the provincial media centre and two policemen.