KABUL (Reuters) - A Taliban suicide bomber and six gunmen attacked the Afghan parliament on Monday as lawmakers met to consider a new defense minister, and another district in the volatile north fell to the militants as they intensified a summer offensive.

Members of Afghan security forces cross a road as smoke billows from the site of an attack near the Afghan parliament in Kabul, Afghanistan June 22, 2015. REUTERS/Ahmad Masood

The brazen assault on the symbolic center of power, along with territorial gains elsewhere, highlight how NATO-trained Afghan security forces are struggling to cope with worsening militant violence.

Fighting has spiraled 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 U.S.-led military intervention toppled them from power.

Monday’s attack began as lawmakers met with the new acting defense 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 gunbattle 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.

“BIG FAILURE”

Taliban spokesman Zabihullah Mujahid claimed responsibility.

“We have launched an attack on parliament as there was an important gathering to introduce the country’s defense minister,” he said by phone, referring to Stanikzai.

Farhad Sediqi was one of several lawmakers who criticized security agencies for not preventing the attack.

“It shows a big failure in the intelligence and security departments of the government,” he said.

The 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 U.S. 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 U.S. 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 center 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.