The attack comes as US and Taliban negotiators continue a ninth round of talks in Doha.
Kabul: Afghan security forces "repelled" a coordinated Taliban assault on the northern city of Kunduz on Saturday, President Ashraf Ghani said, amid competing claims from the insurgents.
The multi-pronged offensive on Kunduz, which has come under frequent attack since 2015, occurred as the US and the Taliban continue to seek an agreement in Doha that would see thousands of American troops leave Afghanistan in return for various security guarantees.
Officials said the fighting started around 1:00 am (2030 GMT Friday), when Taliban militants advanced on the city from several directions. Gunfire could be heard across Kunduz, the capital of Kunduz province near the Tajik border, and as the day wore on, both sides claimed units from the other's forces were surrendering.
But by Saturday evening, the Afghan government said it had gained the upper hand. "The Taliban attacked Kunduz today and caused damages to civilians and their houses. They wanted to create an atmosphere of fear in the city," Ghani said in a statement.
"Their attack was repelled by our brave security forces." A few hours earlier, Taliban spokesman Zabihullah Mujahid claimed Saturday's attack had resulted in the capture of several important structures.
"The Taliban attacked Kunduz city from several directions this morning. We are in the city now capturing government buildings one after the other," he told reporters.
US aircraft supported the Afghan Air Force in joint air strikes, a US official told AFP, while American trainers gave advice to Afghan ground troops.
Interior ministry spokesman Nasrat Rahimi said "hundreds of Taliban terrorists had been killed", but there was no way to immediately verify the claim.
"The situation is under control in Kunduz but clearing operation is ongoing," he said.
An AFP reporter in Kunduz earlier said small-arms and heavy-weapons fire could be heard in four areas of the city but by mid-morning most cellphone coverage had been cut.
The attack comes as US and Taliban negotiators continue a ninth round of talks in Doha. Western diplomats had widely expected an announcement to have been reached by now, but progress appears to have slowed in recent days.
On Thursday, a US commando was killed in the southern province of Zabul, marking at least the 15th American combat death in Afghanistan this year.
The Taliban attack shows they "don't believe in the peace opportunity provided by the US and the government of Afghanistan", Ghani spokesman Sediq Sediqqi said on Twitter.
"On the one hand they are talking with the US, on the other hand they are attacking people's houses and villages. We will not leave their attack unanswered." In late September 2015, the Taliban attacked Kunduz, overwhelming local forces and briefly seizing the city.
It was only through extensive US air support that the Taliban were repelled. The event garnered particular global attention after a US gunship struck a hospital run by Medecins Sans Frontieres (Doctors Without Borders), killing dozens of patients and staff.
The fall of Kunduz also underscored the vulnerability of Afghan security forces and played a role in stopping the pull-out of US forces under president Barack Obama. Since then, the city has come under frequent Taliban attack but the insurgents have not been able to repeat a full capture.