KABUL, Afghanistan — Taliban insurgents seized control of key facilities across a major city in northern Afghanistan on Monday, driving back stunned security forces in a multi-pronged attack that also sent Afghan officials and U.N. personnel fleeing for safety.

The fall of Kunduz would be a huge blow to the Western-backed government in Kabul and give Taliban insurgents a critical base of operations beyond their traditional strongholds in Afghanistan’s south.

For the moment, much of the city was in Taliban hands, and Afghan authorities were left struggling over how to turn the tide.

Kunduz had “collapsed” into Taliban control, Interior Ministry spokesman Sediq Sediqqi said.

Afghan security officials said government forces had withdrawn in attempts to avoid civilian casualties and planned a counteroffensive seeking to regain Kunduz – a city that has already been the target of Taliban attacks twice this year.

“We are prepared and measures have been taken to recapture the city,” the deputy interior minister, Ayoub Salangi, told reporters.

Both Afghan government leaders and the U.S.-led coalition view the defense of Kunduz as a key test of whether security forces could prevent the Taliban from expanding its reach in the country.

One Afghan official said Taliban fighters had control of all major government buildings in the city and security forces had retrenched to try to defend the airport of the provincial capital, about 150 miles north of Kabul in a region that was once relatively stable.

“The defense line for government is now near the airport” on the outskirts of Kunduz, said Amruddin Wali, a member of the provincial council. “The Taliban have taken key government buildings such as the police and intelligence headquarters and burned down some of them.”

The assault appears to be the first time during the 14-year Taliban insurgency that large groups of fighters had managed to penetrate deep into a major Afghan city with significant ground forces rather than isolated strikes and suicide bombings.

A statement from the Taliban also asserted it has taken control of all government buildings, and promised not to seek retribution against local police or military officials.

Kunduz would also hand the Taliban one of the linchpins of Afghanistan’s economy as the hub for the country’s grain region and other important crops.

On a broader level, meanwhile, the attack displays the Taliban’s battlefield power and coordination even as the radical Islamist insurgency faces internal discord following the acknowledgment last month of the death of its longtime leader, Mohammad Omar.