Media playback is unsupported on your device Media caption An eyewitness suggested the attackers were wearing women's burkas, as the BBC's David Loyn reports

Taliban militants who attacked Afghanistan's election commission headquarters have all been killed, police say.

Gunmen broke into a nearby building, disguised as women, and opened fire on the commission compound.

Police said special forces killed four attackers, while the Interior Ministry put the number at five.

The attack comes a week before presidential elections which the Taliban have vowed to disrupt.

Insurgents in the Afghan capital targeted a guest house for foreign aid workers on Friday.

The Taliban threatened to disrupt the Afghan election process and are carrying out what looks like a planned campaign, increasing in intensity as election day approaches. The attack on the election commission is the fourth significant Taliban attack in Afghanistan in the past eight days, beginning with an assault on Kabul's Serena hotel, where they were targeting international election observers. There has also been an attack on a bank in Kunar where police were lining up to cash pay cheques, and an assault on a guest house in Kabul used by foreign aid workers. The latest attack happened as the election commission were planning to make a major announcement on how many polling stations could be opened, amid worsening security in many parts of the country. After making much of the countryside too dangerous for democracy, now the Taliban are turning their attention to the body monitoring the election itself.

Taliban spokesperson Zabiullah Mujahid confirmed to the BBC that the militant group was behind the latest attack.

Deputy Interior Minister Mohammed Ayub Salangi says two policemen were wounded in the attack. There are not thought to have been any casualties among the dozens of Independent Election Commission (IEC) staff and other people in the compound.

The heavily fortified compound includes a series of warehouses and office buildings where candidates are registered and ballot papers are sent out across the country.

'Dressed as women'

The assailants used a three-storey building as a launch pad for their attack on the election commission headquarters.

Kabul police chief General Zahir told the BBC the attackers were armed with rocket-propelled grenade launchers and other weapons.

Image copyright Reuters Image caption At least one warehouse inside the heavily fortified compound was set on fire

Image copyright Reuters Image caption Afghan policemen took up positions on top of a military vehicle outside the compound

Security forces battled the militants for about five hours, while IEC staff and eight international United Nations employees took refuge in safe rooms, AP reports.

Several warehouses in the election commission compound were targeted, and at least one containing election material was reported to have been set on fire.

Abdul Satar Saadat, Chairman of the Electoral Complaints Commission, said election officials were worried by militant attacks and he urged the government to step up security.

"The Taliban warned they will attack every polling centre. They warned every election worker and they started attacking our staff, our offices," he said.

Image copyright AP Image caption A press conference was due to be held in the compound around the same time as the attack

Image copyright AP Image caption Security is a major issue both during and after the presidential elections scheduled for 5 April

Afghan Interior Minister Omar Daudzai told the BBC that security problems during the election were not an issue: "I'm not worried. I'm firm, I'm confident that security will be tight between now and the election, and on election day."

"We are in the middle of a war. For the past 12 years the war has not stopped, but we are confident that these incidents will not derail the election process," he added.

But the BBC's David Loyn in Kabul says there are increasing questions over whether the process can be free and fair, facing such threats.

Airport closed

Afghanistan's main airport in Kabul was closed because of its proximity to the compound under attack, reports Associated Press, quoting airport officials.

Airport director Yaqoub Rassouli said the authorities decided the risk was too high to keep the runway open.

The Taliban has threatened a campaign of violence to disrupt the polls on 5 April, urging its fighters to attack polling staff, voters and security forces in the run-up to the vote.

Many regions have already received the documents ahead of the 5 April vote.

The latest attack came hours before the election commission was due to announce details of how many polling stations would be opened.

If the electoral commission decides the security situation in the countryside is too dangerous to open enough polling stations, it could request a delay to the election. Saturday's attack is likely to focus minds on just how dangerous parts of the country still are, correspondents say.

Recent Taliban attacks include:

28 March: Gunmen trap several people inside guest house housing foreign aid workers in Kabul. Officials say they killed a 10-year-old girl playing outside in the street

25 March: Taliban suicide bomber strikes IEC office in Kabul, killing two policemen

20 March: 18 policemen killed in attack in eastern Afghanistan. Nine killed, including four foreign nationals, in separate attack on an upmarket hotel in Kabul

The election is the first real test of Afghanistan's democracy, as it is the first in which outgoing President Hamid Karzai is not eligible to stand, our correspondent says.