Insurgents were repelled only after five days of heavy fighting and heavy losses to security forces
Afghan president Ashraf Ghani visits Ghazni after Taliban raid
Afghan President Ashraf Ghani visited the south-eastern city of Ghazni on Friday, a week after the Taliban infiltrated the key provincial capital and captured several areas in a surprise attack.
The insurgents hung on in Ghazni for nearly five days before US-backed Afghan forces flushed them out.
Mr Ghani arrived in the city by helicopter and was holding meetings with security officials and elders amid tight security.
"I am here to help all those who have suffered losses, I am committed to build the city and also do everything to protect Ghazni," Mr Ghani said.
"Our soldiers have fought bravely and we stand committed to bringing peace," he said.
The five-day battles with the Taliban in Ghazni, the capital of Ghazni province, killed at least 100 members of Afghan security forces and 35 civilians before calm was restored on Tuesday. Scores of Taliban were also killed, according to Afghan officials
The Taliban still hold sway in much of the province.
Officials at the presidential palace said the devastation and trauma inflicted on thousands of Ghazni residents required urgent domestic and international support.
"The five-day war has come to an end but the complex process of rebuilding the city and protecting it from fresh attacks begins now," a senior official in Mr Ghani's office in Kabul told Reuters.
The US Secretary of Defence James Mattis said the Taliban had six targets in and around the Ghazni city but failed to achieve any of them. He did not specify what the targets were.
Mr Mattis said the insurgents were likely to keep up the recent surge in attacks ahead of parliamentary elections in October but western-backed Afghan defences would not break.
He said the insurgents were probably trying to gain leverage in advance of an expected ceasefire offer by President Ghani, as well as hoping to sow fear in advance of elections in October.
"They achieved a degree of disquiet," he said, but nothing more.
"They have not endeared themselves, obviously, to the population of Ghazni," Mr Mattis told reporters flying with him on Thursday evening to Bogota, Colombia, where he was winding up a week-long tour of South America.
"They use terror. They use bombs because they can't win with ballots."
Mr Mattis said the Taliban lacked the strength to hold the territory they seized for brief periods. "They will never hold against the Afghan army."
The Afghan war has been stalemated for years. The Taliban lack the popular support to prevail, while government forces are too weak to decisively break the insurgents even as they develop under US and Nato training.
Mr Mattis has said he believes the Afghan security forces are gaining momentum and can wear down the Taliban to the point where the insurgents would choose to talk peace. So far that approach has not produced a breakthrough.
Next week will mark one year since President Donald Trump announced a revised war strategy for Afghanistan, declaring there would be no time limit on US support for the war and making a renewed push for peace negotiations.