Taliban gunmen and bombers using fake NATO identification attacked an entrance to the Afghan presidential palace in the heart of Kabul on Tuesday, just a week after insurgent leaders opened an office in Qatar for peace talks.
A nearby building known to house a CIA base also came under attack as explosions and gunfire erupted for more than an hour in the area, which is close to heavily secured Western embassies and ministry buildings. Afghan security officials said all the assailants were killed.
It was one of the most brazen assaults on the city since President Hamid Karzai narrowly escaped assassination in April 2008 when the Taliban attacked an annual military parade.
No civilians were said hurt in Tuesday's attack, and neither the palace nor the CIA base were breached, but police were unable to confirm if any security guards had been killed or wounded.
Two four-wheel-drive cars using fake badges from NATO's International Security Assistance Force (ISAF) tried to pass through a checkpoint to access the sprawling palace grounds at about 6:30 am (0200 GMT).
"The first vehicle was checked and let in, and as the second car tried to get in the guards became suspicious and tried to prevent it," Mohammad Daud Amin, the Kabul deputy police chief, told AFP.
"The clash started and the cars were detonated. All the attackers were killed."
Police said the cars had been fitted with radio antennae to make them look like ISAF vehicles and that the four attackers were also wearing military uniforms.
The car bombs detonated near the CIA base inside the first of several layers of outer checkpoints, but a government official told AFP that the militants had not entered the palace's grounds.
The challenge of securing peace in Afghanistan as NATO troops exit next year was underlined when a bomb killed eight women and one child travelling to celebrate a wedding in the southern province of Kandahar.
Karzai, who lives in the palace, was due to hold a press event in Kabul on Tuesday morning. Officials confirmed that he was in the building at the time of the attack but was in no danger.
All roads to the palace are permanently closed off, with multiple rings of heavy security around the complex keeping people far away.
"A big group of attackers have struck against the CIA office as the main target and also the palace and the defence ministry nearby," Taliban spokesman Zabihullah Mujahid told AFP.
The last major attack in Kabul was on June 11 when the Taliban claimed responsibility for a suicide car bomb outside the Supreme Court that killed at least 15 civilians.
Tuesday's attack came during a visit to Kabul by US envoy James Dobbins after a diplomatic spat over the Taliban's new office in Qatar, whose creation is meant to be a first step towards a peace deal to end 12 years of fighting in Afghanistan.
The Qatar office used the formal name of "Islamic Emirate Of Afghanistan" from the rebels' 1996-2001 government, and flew the white Taliban flag, displaying the trappings of power in a way that infuriated Karzai.
The president broke off Afghan-US talks on an agreement that would allow Washington to maintain soldiers in Afghanistan after 2014.
He has refused to send representatives to Qatar, but pressure is growing for a ceasefire and eventually a peace settlement ahead of the NATO withdrawal and a presidential election due in April.
About 100,000 foreign combat troops, 68,000 of them from the US, are due to exit by the end of 2014, and NATO formally transferred responsibility for nationwide security to Afghan forces a week ago.
When in power, the Taliban imposed a harsh version of Islamic law that banned television, music and cinema, stopped girls from going to school and forced woman to wear the all-covering burqa.
They were ousted in 2001 for sheltering Al-Qaeda in the aftermath of the 9/11 attacks, but launched a resilient and bloody insurgency against US-led NATO troops and the US-backed Afghan government.
Dobbins on Monday said the United States was "waiting to hear" whether the militants were committed to peace talks after opening the Qatar office.
"It doesn't seem like an entirely spurious effort on their part but whether they are prepared to participate... we just don't know,' he told reporters.