A marathon siege in Kabul's diplomatic enclave ended on Wednesday with the death of the last two of a group of gunmen who had held off Western and Afghan security forces for nearly 20 hours, showering rockets on Western embassies in a dramatic show of insurgent strength.
It was the longest and most audacious militant attack on the Afghan capital in the decade since the Taliban were ousted from power and a stark reminder of insurgents' resources and reach as Western forces start to return home.
At least 11 civilians were killed, three of them children, NATO-led foreign forces said. The Ministry of the Interior said four policemen died, and that toll was likely to rise.
US Ambassador Ryan Crocker said about six or seven rockets had hit inside the embassy perimeter during the early hours of the attack, launched early on Tuesday afternoon, but said the range meant they had not posed a serious threat.
"They were firing from at least 800 meters away and with an RPG (rocket-propelled grenade) that's harassment. That's not an attack," he said in an interview transcript handed out to journalists in Kabul.
The insurgents had holed up in a multi-storey building still under construction and launched their attack by firing rockets towards the US and other embassies and the headquarters of NATO-led foreign forces.
Three suicide bombers also targeted police buildings in other parts of the city, but the embassy district assault was the most spectacular.
Afghan security forces backed by NATO and Afghan attack helicopters fought floor-by-floor in the 13-storey building, which the six insurgents appeared to have booby trapped.
They had arrived under burqas, the traditional face-veiling robe worn by Afghan women, in a car packed with explosives, and entered the high-rise after shooting a security guard.
"As our country is traditional and Islamic, there is a special respect for women and the enemies exploited this to get to the building," Kabul Police Chief Ayoub Salangi said.
The gunmen then hid from helicopters and government and foreign troops in lift shafts and a maze of small rooms.
The group were armed with rocket-propelled grenade launchers, AK-47 assault rifles and suicide bomb vests, a Taliban spokesman said, but the time they held out prompted speculation they had hidden weapons in the building.
"There was almost certainly either a breakdown in security among the Afghans with responsibility for Kabul or an intelligence failure," said Andrew Exum, fellow at the Center for a New American Security.
Explosions were interspersed with gunfire all afternoon on Tuesday and continued past dawn on Wednesday. Residents of nearby apartments stayed indoors and tried to comfort panicked children, as helicopters flew low overhead.
"It would go silent for 30 to 35 minutes and then there were explosions and the sound of heavy machine guns," one Reuters witness said of a sleepless night. There may be unexploded artillery in parts of the city, NATO warned.
Embassies and restaurants frequented by foreigners were on lock-down all evening. The US and British embassies and the NATO-led coalition said all their employees were safe.
Ambassador Crocker said he believed the Haqqani network was behind the attack, and also blamed them for a truck bomb that wounded 77 US troops on 10 September.
Named after its leader, Jalaluddin Haqqani, it is one of three, and perhaps the most feared, of the Taliban-allied insurgent factions fighting US-led NATO and Afghan troops in Afghanistan.
They are thought to have introduced suicide bombing to Afghanistan, and are believed to have been behind many high-profile attacks in Kabul, including an assassination attempt on President Karzai and assaults on two top hotels.
The network gets some support in lawless lands on the Pakistani side of the border although the Pakistani government has long dismissed suggestions of links between the militant group and its security agents.
Afghan Ministry of the Interior spokesman Sediq Sediqqi said that although it was too early to say the attack was the work of the Haqqani network, "it is similar to attacks carried by Haqqani".
Violence is at its worst since US-backed Afghan forces toppled the Taliban government in late 2001, with high levels of foreign troop deaths and record civilian casualties.
The assault was the second big attack in the city in less than a month after suicide bombers targeted the British Council headquarters in mid-August, killing nine people.
In late June, insurgents launched an assault on a hotel in the capital frequented by Westerners, killing at least 10.
A US Senate panel has approved a $1.6 billion cut in projected US funding for Afghan security forces, part of a significant reduction in outlays for training and equipping Afghan army and police expected in the coming years.