KABUL - 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 an area close to heavily secured Western embassies and ministry buildings.

Three Afghan security guards and all five assailants were killed, the interior ministry said.

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.

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 not in danger.

The strike also came during a visit to Kabul by US envoy James Dobbins after a dispute over the Taliban opening an office in Qatar as a first step towards peace talks ending 12 years of war.

The three guards were killed close to the Ariana hotel building, used as a CIA base since about 2002, but officials said neither the palace nor the CIA property were breached.

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 attackers were also wearing military uniforms.

The car bombs detonated near the CIA base, inside the first of several layers of outer checkpoints for the palace.

“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.

Karzai condemned the attack, saying “the Taliban have opened an office in Qatar to talk with foreigners, on the other hand they are killing innocent civilians in Afghanistan. They should be accountable to people for this”.

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.

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.

All roads to the presidential palace are permanently closed off, with multiple rings of heavy security around the complex keeping people far away.

These attacks could derail attempts for peace talks to end 12 years of war.

A Reuters reporter at the palace said the attack began soon after 6.30 am (3:00 a.m. British time) when at least one man opened fire with an automatic rifle close to a gate to the palace in central Shash Darak district. The fighting was over before 8 am.

Reporters at the palace gates for security checks took cover when the firing started. Last week the Taliban opened an office in Qatar using 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.

US envoy 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.

In another incident, eight Afghan women and two children were killed and three adult men were wounded Tuesday morning when a vehicle was struck by a roadside bombing in the southern province of Kandahar, an official said.

“The ill-fated minibus was travelling from Zharay district to neighbouring Khakrez. The bus touched off the bomb placed along the road in Khakrez district. The explosion killed eight women and two children on the spot at about 8:00 am local time,” provincial government spokesman Jawid Faisal told Xinhua.

Kandahar, 450 km south of Afghan capital Kabul , has been notorious for growing poppy and the Taliban hotbed.

The Taliban-led insurgency has been rampant since the militant group began annual rebel offensive against Afghan government forces and about 100,000 NATO-led troops stationed in the country in April.

Taliban militants, who have been waging an insurgency for more than one decade, use Improvised Explosive Devices to launch roadside bomb attack on security forces but the lethal weapon also inflicted casualties on civilians.

More than 2,000 civilians have been killed or injured since January this year in the war-hit Afghanistan, according to the United Nations mission in the country.