KABUL - A Taliban suicide bomber and six gunmen attacked the Afghan parliament on Monday as lawmakers met to consider a new defence minister, and another district in the volatile north fell to the militants as they intensified a summer offensive.
The brazen assault on the symbolic centre of power, along with territorial gains elsewhere, highlight how NATO-trained Afghan security forces are struggling to cope with worsening militant violence.
Fighting has spiralled since the departure of most foreign forces from Afghanistan at the end of last year. The insurgents are pushing to take territory more than 13 years after US-led military intervention toppled them from power.
Monday's attack began as lawmakers met with the new acting defence minister, Masoom Stanikzai. He is the third candidate so far for the key security post, and his appointment must be confirmed by parliament.
A Taliban fighter detonated a car loaded with explosives outside parliament gates, said Ebadullah Karimi, spokesman for Kabul police, raising questions about how the driver got through several security checkpoints.
Six gunmen took up positions in a building near parliament, he said, but never breached the compound's gates.
Essa Khan, a soldier inside the parliamentary compound when the attack took place, said he shot dead three militants as they tried to storm inside before killing the rest in a prolonged gun battle that also involved other troops.
"Everywhere there was smoke and dust," Khan told Reuters.
"I knew that it was the Taliban from the first moment. I grabbed this gun and shot three of them dead," added the 28-year-old, whose actions have played prominently on Afghan media in a rare PR success for the beleaguered armed forces.
Kabul police chief Abdul Rahman Rahimi said all lawmakers were safe. TV pictures showed the speaker sitting calmly and legislators leaving the building, engulfed in dust and smoke, without panicking.
A woman was killed and around 30 civilians were wounded in the attack, according to Rahimi.
He said the assailants were armed with assault rifles and rocket propelled grenades. Some lawmakers' bodyguards fired sporadically during the attack, hampering the response by Afghan forces, he added.
Police will investigate how the attackers got so close to parliament.
"We have appointed a delegation to find the weak point or points and report it back to us," Rahimi said.
Taliban spokesman Zabihullah Mujahid claimed responsibility.
"We have launched an attack on parliament as there was an important gathering to introduce the country's defence minister," he said by phone, referring to Stanikzai.
Farhad Sediqi was one of several lawmakers who criticised security agencies for not preventing the attack.
"It shows a big failure in the intelligence and security departments of the government," he said.
In Washington, a US State Department spokesman said that despite the assault, Afghanistan's security forces were improving.
"Although the insurgents have executed a number of violent attacks since the announcement of the 2015 fighting season, including the attack on parliament, the (Afghan security forces) have demonstrated their growing capability to provide security," the spokesman said.
At the UN Security Council, the UN envoy to Kabul, Nicholas Haysom, said Afghanistan's security forces were "undeniably stretched" but resilient amid a push by insurgents for more territory and concerns that Islamic State militants were also seeking a foothold in the country.
Monday's attack fits a pattern of high-profile assaults on heavily fortified buildings in the capital. Last month, car bombs targeted the Ministry of Justice, and attackers stormed two guesthouses used by foreigners.
In 2013 the presidential palace was hit, and the US embassy has been attacked several times, notably in 2011 when nine people were killed and 27 wounded in coordinated strikes on the embassy and other targets.
This year, the withdrawal of foreign forces and a reduction in US air strikes have allowed Taliban fighters, who ruled Afghanistan with an iron fist from 1996 to 2001, to launch several major attacks in important provinces.
A district in the northern province of Kunduz fell to the Taliban on Monday, the second such loss in two days. Officials said the militants were able to take over when urgently needed reinforcements failed to arrive.
The Taliban captured Dasht-e-Archi district a day after hundreds of militants fought their way to the centre of the adjacent district of Chardara.
"The Taliban managed to take it over this morning as the area has been surrounded for days," Nasruddin Saeedi, the district governor who escaped to the provincial capital, Kunduz city, told Reuters by telephone.
"There are many foreign fighters with heavy machine guns. We have asked for reinforcements, but none arrived."
Afghan soldiers were preparing a counterattack to retake both districts, another local official said.
Monday's heavy fighting was just three km (two miles) from the provincial governor's compound.