Mayhem and confusion during Kabul's night of violence
Minute by minute, the BBC's Bilal Sarwary monitored the dramatic events at Kabul's Intercontinental Hotel as they unfolded. Here is his account:
The first sign of what lay ahead came when a friend called to tell me that he was at the Intercontinental Hotel.
As he was speaking, the gunfire started.
"Fayar! Fayar!" he said, using the Dari word for firing. For the next five minutes or so, there was silence.
Eventually my friend confirmed there had been an attack on the hotel.
In the event he was one of the lucky ones. Musicians, hotel workers and a judge were killed as suicide attackers fought Afghan security forces.
For the men, women and children who had booked a room in the hotel for a wedding, it was a night of sheer hell as gunfire and the sound of grenades interrupted their celebrations and the hotel was transformed into a battleground.
A major conference was also being held in the hotel to discuss Nato's process of transferring responsibility for security to Afghan forces.
The head of Takhar provincial council, Mawli Hamdullah Warsaj, told the BBC: "I had gone there to have dinner with some friends. I already had a feeling something was happening. As soon as I arrived, I went to meet my friends from a construction firm, to discuss the building of a road in my province. I wanted to leave but my host insisted I stayed.
"As soon as I had finished eating, I noticed a car trying to bring in some people. I saw one of them; he had a beard. Then there was shooting in the air. Several of these attackers were running and firing at the parking area, where some Afghan governors were.Armoured windows broken
"The other group started running towards the hotel. They had RPGs and heavy machine weapons. One of them had 15 RPG rounds all tied to his body.
"This is when they shot dead my friend, senior provincial judge, Mansoor. He had served in Takhar province and now he was a senior provincial judge. Then I didn't know what was happening. There was chaos. They were firing everywhere."
This attack in the heart of Kabul had all the hallmarks of the Haqqani network, a group closely allied to the Taliban, but which operates independently, a security official told the BBC.
Kabul police chief Ayub Salangi and his forces found themselves up against a determined group of attackers armed with heavy machine guns, rocket propelled grenades and automatic weapons.
Such was the intensity of the firing that the armoured windows of Mr Salangi's vehicle were broken.
Unlike most militant attacks, this one took place late into the evening. It took many people - including the Afghan security forces - completely by surprise.
The Intercontinental lies on a hilltop over looking the city. Built in 1969, it is a popular hotel with senior officials, wealthy Afghans, foreign diplomats and journalists.
The hotel covers a large area. It has a swimming pool, a tennis court and an outdoor restaurant that can seat 160 people.
According to one Afghan intelligence official who was at the scene of the attack, three attackers opened fire with grenade launchers and heavy machine guns in the parking area, where a group of Afghan governors and politicians had finished their dinner.
The official said that three people were killed in front of his eyes.Loud explosions
"The governor's bodyguards returned fire and there was chaos. No one knew who was firing where,'' the official said.
Meanwhile at least three militants started attacking the front gate of the hotel, heading towards guests' rooms.
A suicide attacker managed to get onto the second floor, while another detonated his vest at the back of the hotel.
"There was total panic and everyone started running. We were told not to open our doors to anyone," a hotel guest told the BBC shortly after the attack started.
In the ensuing five-hour battle with the security forces, some of the attackers managed to get onto the hotel roof, from where they began firing at troops and policemen.
The hotel's electricity was cut so that Afghan forces could use night vision equipment, adding further to the sense of confusion and panic among guests and local residents.
Finally the security forces called for Nato's help to deal with the rooftop attackers, because Afghan helicopters do not have night vision equipment.
Once the Nato helicopters had killed the attackers, it was thought the fighting was over. The firing from the helicopter hit the hotel's fifth and sixth floors, creating a fire and yet more confusion.
But there was a further explosion hours later, when one of the attackers - who had hidden in the hotel - detonated the explosive vest he was wearing.'Loophole in security'
A sense of the ferocity of the fighting was given to the BBC by aides to Vice President Mohammad Qasim Fahim, who lives near the hotel. They said bullets landed close to his house.
Afghan intelligence officials told the BBC that the priority now is to investigate how the insurgents got so much heavy weaponry into the hotel. One said it was possible that the weapons were placed there in advance.
"We believe that there was a loophole in security, definitely. There was reconstruction and renovation work going on in a part of the hotel. The insurgents are using every means to infiltrate into tight security areas. They might have camouflaged themselves as labourers, as technicians," said National Directorate for Security spokesman Latifullah Mashal.
Officials close to President Karzai said "terrorist attacks like this" take place everywhere in the world, and that - in this case - the Afghan security forces dealt with the attack within hours.
This is the second attack in Kabul in the past month - a suicide bombing at a hospital in the capital in May left six dead. Police say they have seized weapons from several districts in the city over the past few weeks, and warn that another attack could be in the offing.