Heavily armed Taliban militants stormed a top Kabul hotel, sparking a ferocious battle involving Afghan commandos and a NATO helicopter gunship that left at least 21 dead including the nine attackers. Officials said all of the gunmen were killed during the night-time raid on the hilltop Intercontinental Hotel, frequented by Westerners and Afghan officials, part of which was left in flames as tracer bullets lit up the sky. The state-owned 1960s hotel, which is not part of the global InterContinental chain, was hosting delegates attending an Afghan security conference and a large wedding party when the insurgents struck late Tuesday. The interior ministry said nine Afghan civilians -- mostly hotel workers -- and two police officers were killed in the brazen assault and another 18 people were wounded. It said a ninth dead Taliban militant had been identified. The ministry and the government in Madrid said a Spanish man -- reportedly a pilot working for a Turkish airline -- was also killed at the hotel. Interior ministry spokesman Seddiq Seddiqi said the slain hotel workers had been on the first floor and in the lobby at the time of the attack. Among those staying at the hotel were provincial government officials who were in Kabul for a conference on the handover of power from foreign to Afghan security forces. The process starts next month. President Hamid Karzai condemned the attack, praised the work of the Afghan troops and reiterated support for the transfer of responsibility for security from foreign to national forces. \"This incident and ones like this will not stop the transfer of responsibility to (national) security forces,\" he added, according to official statements. In his first public comments on the attack, US President Barack Obama on Wednesday insisted that \"Kabul is much safer than it was and Afghan forces in Kabul are much more capable than they were\". \"That does not mean there will not be events like this taking place. That will go on for some time. Our work is not done,\" he told a White House press conference. Two New Zealand special forces troops who had been supporting the Afghan commandos received \"moderate injuries\" in the raid, the country\'s defence force said. An AFP photographer saw half a dozen of what appeared to be Western special forces soldiers emerging from the Intercontinental compound, one of whom had blood on his right cheek and on his hands. The attackers steered clear of the normally heavily guarded road snaking up to the hotel, instead picking their way through the trees on the northern slope towards the building around 11:00 pm on Tuesday, police said. Panicked guests were told to stay in their rooms as the attackers, thought to have suicide vests, machine guns and rocket-propelled grenades, roamed through the building for about four hours before the raid was quelled. Major Tim James, a spokesman for NATO\'s International Security Assistance Force, said ISAF deployed one helicopter at the request of Afghan authorities which circled the hotel, opening fire on a number of insurgents wearing suicide vests. \"We\'ve had reports that there were a number of explosions caused either by the insurgents detonating themselves or the engagement by the helicopter causing that (suicide vests) to explode,\" he said. Witnesses identified the NATO aircraft as an Apache attack helicopter. A member of staff named Ezatullah said he hid in a room on the fifth floor when the attack started. \"There was first gunfire, and then two blasts. It continued and got worse. The room I was hiding in filled with smoke,\" he said. \"I had to leave. As I got out I saw trails of blood, and then the police came and took me out of the building.\" Security at most high-end hotels in Kabul was significantly stepped up after an attack on the city centre\'s Serena Hotel in 2008 left seven people dead. The Intercontinental is less deluxe than the Serena, which is the favoured choice of foreign officials and business people visiting the Afghan capital. The US State Department said: \"The United States strongly condemns the attack on the Intercontinental Hotel in Kabul, which once again demonstrates the terrorists\' complete disregard for human life.\" During the assault, AFP reporters saw 10-15 armoured vehicles carrying Afghan commandos entering the hotel compound. The reporters heard five separate explosions as the attack unfolded and said the hotel was in darkness after power in the area was apparently cut. Ambulances rushed to the site to ferry away casualties. Taliban spokesman Zabihullah Mujahid said the militant Islamist group was behind the attack. Some 10,000 US troops are due to leave the country this year, ahead of the planned end of foreign combat operations at the end of 2014. Security in Kabul is already under the control of Afghan forces.