Few pictures have emerged from the city since the assault began
The Taliban have launched a major night-time assault on the Afghan city of Ghazni, a provincial capital on the key highway between Kabul and Kandahar.
The militants took control of parts of the city before being pushed back to the outskirts, officials said.
Thirty Taliban fighters and one Afghan security forces’ member were killed, according to the provincial government.
The number of casualties is expected to rise as many houses were destroyed.
At least eight civilians and seven government security personnel were injured, provincial government spokesman Mohammad Arif Noori Ghazni told the BBC. Sporadic gunfire could still be heard in the city, where Afghan special forces have been deployed.
The assault marks the fourth time that the Taliban have entered a provincial city in recent years. The militant group earlier said that hundreds of fighters had been involved and that government buildings, including the police headquarters, had been captured.
“We are scared for our life. The Taliban are roaming everywhere in and around the city,” shopkeeper Mohammad Haleem told AFP news agency.
Earlier this year the Taliban briefly took the western city of Farah, and for periods in both 2015 and 2016 the militants overran Kunduz, in the north.
The US military’s Resolute Support mission said it had deployed attack helicopters and a drone to help repel the Taliban from Ghazni, which has about 150,000 residents.
Taliban ‘threaten 70% of Afghanistan’
A spokesperson said the attack was “another failed Taliban attempt to seize terrain, which will result in yet another eye-catching, but strategically inconsequential headline”.
The highway from Kabul to Ghazni, and from Ghazni heading further south, was closed on Friday.
The attack comes as pressure continues on the Taliban to enter peace talks with the Afghan government.
Secret talks were recently held in Qatar between Taliban and US officials after an unprecedented three-day ceasefire during Eid celebrations in June that was largely respected by both sides.