A fierce Afghan counteroffensive, backed by U.S. air power, might soon wrest control of a key northern city from Taliban insurgents.

But the fall of Kunduz in the first place has dealt a glaring blow to Afghans’ war-battered psyches as well as their confidence in President Ashraf Ghani’s government, analysts say.

The insurgents’ multi-pronged assault Monday on Afghanistan’s fifth-largest city marked a significant success for a group that had failed in 14 years of conflict to take over a major urban center and had been circling Kunduz for months.

Afghan forces surrounded the city of 300,000 on Tuesday and began what officials called a “clearance operation,” after U.S. warplanes carried out at least one airstrike against the insurgents in the morning. At least 16 people have been killed and 172 injured, according to Afghanistan’s Public Health Ministry, and casualties were expected to rise.

In Kabul, the Afghan capital, Ghani said in a televised address that “Kunduz is under control” and would soon be back in government hands. His appointed governor for Kunduz province, Omar Safi, was in Tajikistan at the time of the attack and had not yet returned to Afghanistan.

The Pentagon confirmed that it provided aerial surveillance and conducted one airstrike with a manned aircraft on the outskirts of Kunduz on Tuesday morning "in order to eliminate a threat to coalition forces."

"The situation in Kunduz remains fluid, and we are continuing to follow the situation closely, but we have confidence in the Afghan national security forces," said Pentagon spokesman Peter Cook, calling the Taliban attacks "a setback."

Several towns and districts have fallen to a resurgent Taliban this year, and nearly all of them have swiftly been retaken by Afghan forces. But the group’s gains in Kunduz, just as Ghani’s government marks its first anniversary this week, underscore its strength in a strategic province and the failure of Ghani’s strategy of empowering local strongmen to bolster government forces.

“The biggest gain for the Taliban … is the lost trust for the government among the people of Kunduz,” said Abdul Waheed Wafa, director of the Afghanistan Center at Kabul University.

Afghanistan’s 352,000 soldiers and police officers have often struggled since the shrinking U.S.-led international military mission moved into a supporting role at the start of the year. In the spring, when the Taliban began its offensive in Kunduz province, the government called on Mir Alam Khan, a militia commander who was in neighboring Tajikistan at the time.

Like other such commanders, Khan, an ethnic Tajik, has been accused by locals of extortion, physical abuse and intimidation. Ghani’s alliance with Khan and others, analysts say, has eroded the public’s faith in the government, which they accuse of allowing the strongmen to operate with impunity.

Forces loyal to Khan, for example, have been accused of killing 12 villagers in a predominantly ethnic Pashtun village in 2012, allegedly as payback for the death of one of his militia members, according to Human Rights Watch.

“The people are fed up with these strongmen that are essentially carrying out their personal ambitions and abusing the people,” said Obaid Ali, a Kabul-based analyst who has traveled extensively in Kunduz.

A 2009 State Department cable obtained by the anti-secrecy website WikiLeaks cited Khan’s forces as an example of an armed group that is “reportedly connected to the National Directorate of Security” — Afghanistan’s main intelligence agency — “but seems to operate without government guidance, command or control.”

“The leadership of these militias is connected to Kunduz’s representatives in the parliament, the police and military as well as other organs of the security forces — all of whom protect them,” Ali said.

As in other areas of the country with a large presence of armed militiamen, such abuses have prompted an increase in popular support for the Taliban, Ali said. That has enabled some Taliban fighters to seek shelter in the homes of locals who support them against the militias.

Pictures of Kunduz residents apparently snapping selfies with Taliban fighters began popping up Monday on social media sites.

Yet many in Kunduz are reportedly terrified of the Taliban incursion. Local officials said the group seized the city’s main traffic circle and freed more than 600 prisoners Monday afternoon, although the reports could not immediately be verified.

Amnesty International said Tuesday that Taliban fighters had looted offices and seized equipment belonging to international relief agencies including the International Committee of the Red Cross, and had burned offices of private media.

“Civilians are bearing the brunt of the horrific violence that is unfolding in Kunduz,” said David Griffiths, Amnesty's South Asia research director. “By hiding in residential homes, Taliban fighters are exposing civilians to attacks.”

Wafa, who was in contact with people in the city, said many residents hid in their basements, fearing that the insurgents would go door-to-door looking for members of government security forces.

“I’ve been through the wars in Kabul, I can only imagine what horrors the people of Kunduz had to suffer through last night,” the Kabul University academic said.

Lola Cecchinel, head of research at ATR Consulting, a Kabul-based research agency, said the Afghan government’s development efforts in Kunduz have benefited a small circle of political elites, leaving ordinary residents behind.

Regardless of the militants' ability to hold on to the city, Cecchinel said Monday’s incursion was a big statement by the Taliban to the government, Afghans and the international community.

“They have been trying to get to Kunduz city for the last year and this week they were able to do just that,” Cecchinel said. "More than the capacity of the Taliban, the fall of Kunduz shows the incapacity of the government.”

Special correspondent Latifi reported from Kabul and Times staff writer Bengali from Ootacamund, India. Staff writer W.J. Hennigan in Washington contributed to this report.