Afghan government forces are back in control in parts of the city of Kunduz, three days after it was captured by the Taliban, an Afghan special forces commander on the ground told Al Jazeera.
Operations were ongoing on Thursday morning to take control of the entire city, the commander said.
He said the Taliban left the centre of the city, now under government control, on Tuesday night following a US air strike that decimated their ranks.
Residents and security sources said the army was facing stiff resistance in residential areas still held by the Taliban.
The Afghan interior ministry claimed control of the city in a statement.
"It is retaken and being cleared from terrorists, with heavy casualties to the enemy," Interior Ministry Spokesman Sediq Sediqqi said on Twitter.
ANALYSIS: Why Taliban focus is on freeing prisoners
The Taliban attack on Kunduz began at dawn on Monday with the fighters capturing key buildings and freeing hundreds of prisoners, who included members of the group.
The ensuing fighting between the Taliban and security forces sent thousands of residents fleeing.
The incursion came after two failed attempts this year to capture Kunduz city, which has been encircled by the fighters for about a year.
The takeover was the group's biggest victory since the Taliban government was ousted in 2001.
"The fact that the Taliban can actually take the sixth largest city in Afghanistan, and hold it for a couple of days, sends a signal to the government and the international community about the future of Afghanistan," said David Sedney, a former deputy US Assistant Secretary of Defense for Afghanistan and Pakistan.
He told Al Jazeera that to improve the country's security, the government must take several measures, including getting the military organised.
"The Afghan government doesn't even have a defence minister after one year of unity government. This is a government that needs to get down to business and not just talk about having a better security situation.
"Afghan soldiers are great fighters ... They're willing and able to fight, but they need a good leadership."
President Ashraf Ghani took office a year ago pledging to restore peace to Afghanistan.
The US and NATO troops play a vital role in training and assisting the Afghan forces. US air strikes on Tuesday and Wednesday hit Taliban positions during fierce fighting for control of Kunduz's airport.
Source: Al Jazeera and agencies