KUNDUZ, Afghanistan (Reuters) - Afghan troops recaptured the center of the strategic northern city of Kunduz on Thursday amid fierce clashes with Taliban militants, three days after losing the provincial capital in a humbling defeat for Kabul and its U.S. allies.

Fighting continued in other parts of the city, the seizure of which represented a major victory for the insurgents and raised questions over whether NATO-trained Afghan forces were ready to go it alone now most foreign combat troops have left.

Residents said soldiers were conducting house-to-house searches and had removed the Taliban flag from the central square, replacing it with government colors.

“There are military helicopters in the sky and government forces everywhere,” said Abdul Ahad, a doctor in the city. “Dead Taliban are on the streets, but there are still (militants) in some government buildings fighting Afghan forces.”

A Taliban spokesman said fighters had withdrawn to the edges of the city in order to attempt to encircle Afghan and U.S. troops.U.S. special forces accompanied and later fought alongside Afghan soldiers, the international military coalition confirmed, saying that they returned fire in self-defense.

The Afghan army’s Deputy Chief of Staff, Murad Ali Murad, said most Taliban fighters had fled, although some were holed up in civilians’ homes.

A Ministry of Defence statement said 150 Taliban had been killed and 90 wounded in the overnight offensive.

At least 30 people, mostly civilians, had been killed in the fighting as of Wednesday, according to a Health Ministry spokesman. He also said hospitals in Kunduz had treated about 340 wounded.

Wreckage from the battle was visible outside the city airport. Afghan soldiers said a burned out Humvee was hit by a U.S. air strike, and the bodies of half a dozen dead Taliban fighters were scattered along the road and in a nearby orchard.

Soldiers had taken photos of the dead militants and were proudly displaying them to their colleagues.

RESIDENTS IN HIDING

Terrified residents said there was intense fighting overnight as Afghan forces moved in.

“There were very heavy air strikes during the night. Those strikes prompted the Taliban to escape,” Kunduz resident Abdul Qadir Anwari said on Thursday.

“Right now Afghan security forces are on the streets and fighting with the Taliban in some areas outside the city. Shops are still closed and people aren’t leaving their houses.”

Taliban spokesman Zabihullah Mujahid said fighting continued.”It was our tactic to vacate the city to allow enemy troops to enter so we could encircle them,” he said.

A spokesman for the NATO mission said U.S. special forces advisers were traveling with Afghan troops on their offensive when they came under threat from the Taliban.

The Americans “returned fire in self-defense to eliminate the threat,” he added.

Slideshow ( 6 images )

The spokesman confirmed that there had been five U.S. air strikes against Taliban positions near the city and airport since fighting began on Monday “to eliminate threats to coalition and Afghan forces.”

The Taliban, whose harsh interpretation of Islamic law during a five-year rule included public executions and denying women rights to work and education, have been fighting to regain power since being toppled by a U.S.-led intervention in 2001.

The once-quiet north of Afghanistan has seen escalating violence in recent years as the insurgency spread, and swathes of Kunduz province have repeatedly come under siege this year.

Yet the Taliban’s pre-dawn assault on Kunduz on Monday caught the Afghan police and army by surprise, handing the militants arguably their biggest victory in 14 years of war.

Slideshow ( 6 images )

The capitulation may have consequences for President Ashraf Ghani, whose first year in office has been clouded by political infighting and escalating violence around the country.

“I hope there is no doubt about the capacity and ability of Afghan forces,” he told a news conference on Thursday.

FIERCE STRUGGLE

Events in Kunduz have belied the narrative that the NATO-trained Afghan police and army were steadily improving and able to prevent the Taliban from taking over and holding significant territory.

Training the 350,000-strong Afghan National Security Forces has been the heart of the U.S. plan to end involvement in its longest war. NATO forces officially wound up their combat role last year, leaving behind a training and advising force of several thousand.

Chief Executive Abdullah Abdullah told Reuters on Wednesday that the crisis in Kunduz demonstrated the need for foreign troops to stay in the country.

“As far as I understand, the view of all those (U.S.) Army generals and officers on the ground ... in Afghanistan, as well as our own security and military leadership, is that maintaining a level of force beyond 2016 is necessary,” he said in New York.

While Afghan forces celebrated on Thursday, some warned that the Taliban’s retreat could be temporary, especially because the insurgents looted banks and seized military equipment during their three-day occupation.

“There are huge amounts of cash floating around, weapons and ammunition,” said Ted Callahan, a Western security analyst. “They have moved stockpiles (to outlying districts) because they knew they wouldn’t hold the city for long.”