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.

At least 16 people have died and 40 have been taken to hospital, Ghazni's health director told the BBC. He said most were security forces personnel.

But the government says it has killed or injured scores of militants.

The number of casualties is expected to rise as many houses were destroyed.

Late on Friday morning, 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.

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.