Afghan and foreign troops battled the insurgents who targeted the US embassy and NATO headquarters, sowing fear and confusion and raising fresh questions over the government's ability to secure the country even after a ten-year war.
The standoff ended when troops finally killed the two last insurgents who had held out overnight in a high-rise building under construction just a few hundred metres from the heavily guarded US embassy.
"The last attackers are dead and the fighting all over. There were six terrorists in the building and all are dead," interior ministry spokesman Siddiq Siddiqui told AFP.
But by holding the city hostage over two days in their longest attack on the capital yet, the insurgents demonstrated their increasing confidence with the latest in a string of attacks on Western targets in recent months.
The raid was another sign that security has deteriorated sharply in Kabul, which was hit with a suicide bombing on the British Council cultural body last month and the storming of the luxury Intercontinental Hotel in June.
The latest standoff came to an end after helicopters from the NATO-led International Security Assistance Force (ISAF) were sent in to assist Afghan forces, but Siddiqui did not say how the last insurgents were killed.