At least 20 Taliban militants were killed and eight others injured after Afghan government forces foiled an attack on Aybak city, capital of the northern province of Samangan, the Interior Ministry confirmed on Monday.
The Ministry said in a statement that Taliban fighters fled surrounding areas of the city after casualties were inflicted, reports Xinhua news agency.
The militants stormed the city from several directions on Sunday night, trying to take control.
Earlier on the day, Taliban spokesman Zabihullah Mujahid wrote on social media that the insurgents seized control of several areas in Aybak.
On Sunday night, the Taliban also attacked Pul-e-Khumri city, capital of neighbouring Baghlan province, triggering heavy battles, according to local sources.
Many Afghan cities and about half of the country's 34 provinces have been the scene of heavy battles and street fighting in recent weeks as Taliban militants continued their fighting against security forces.
Taliban militants have taken control over three provincial capital cities of Taluqan, Sari Pul and Zaranj after heavy clashes in recent days.
The armed outfit has captured nearly 200 districts over the past three months.
Taliban Received Men, Weapons, Explosives From Pakistan
The Taliban have received men, weapons and explosives but also direction from across our southern frontiers, which is Pakistan, said Ahmad Shuja Jamal, head of international affairs at Afghanistan's National Security Council.
In an interview with Al Jazeera, he said: "That is why (they) are able to put up with such a stiff resistance across the country."
Jamal said of the many explosive devices that were used to killed American soldiers in Afghanistan, 80 per cent of them used ammonium nitrate which is fertiliser but also a precursor for explosives were produced in two Pakistani factories.
"If you focus on a given sliver of time, at any given moment, a province may have come under the Taliban's control. But I think the situation remains completely fluid, which means, as we are speaking, the Afghan National Defence and Security Forces are actually rallying and pushing the Taliban out of the province of Kunduz.
"Similar action is happening in Sheberghan and similar action is happening in other provinces that you've listed as having fallen into the Taliban's hands," he said.
The Taliban militants are not capable of holding the provincial capitals. They have simply been unable to do that and as you have said a few moments ago, the last time they were able to capture any provincial capital was six years ago in 2015, he added.
Jamal said the civilians are really bearing the brunt of all of this.
"Because we've seen an increase in civilian casualties just as the Taliban have escalated their violence. Approximately two-thirds of the casualties have been women and children and that speaks to the Taliban's modus operandi which is that they're using civilian homes to hide but also launching attacks and that is creating a terrible toll for civilians."
Jamal said Kunduz is the gateway to Central Asia because if the Taliban is able to establish a toehold in this province, then with the multiple terrorist organisations, the IMU in Uzbekistan, the Ansar Allah from Tajikistan, and the multiple other ones, they are able to link Central Asia so the fight here by the NDSF is not just for us but it is for Central Asia and the neighbourhood.
"We are fighting a transnational terrorist threat that is manifested in the form of the Taliban," he added.