KABUL (Reuters) - Afghan troops backed by U.S forces gained control of most of the embattled city of Ghazni on Tuesday, officials said, while a Taliban attack in another province raised new questions about Afghanistan’s defenses against the insurgency.

An Afghan National Army (ANA) soldier keeps watch at a checkpoint on the Ghazni - Kabul highway, Afghanistan August 14, 2018.REUTERS/Mohammad Ismail

After five days of fighting, Ghazni, a strategically vital center two hours from Kabul on the main highway between the capital and southern Afghanistan was a city of burned-out buildings and vehicles with bodies lying in the streets.

Local officials had been warning for months that the Taliban’s growing control over surrounding districts had left Ghazni vulnerable to attack and President Ashraf Ghani faced bitter accusations over the failure to protect the city.

The government has faced accusations of incompetence, neglect and complacency, as well as anger at its repeated assurances that the Taliban attack had failed, even while hundreds of fighters were roaming at will through the city.

“The government knew about Ghazni very long ago and did little to protect it. “All we heard from officials were lies and deceit and the people know this,” said Etemadi, who added that fighting was still going on.

The assault, which shocked the country, raises fresh questions over parliamentary elections scheduled for Oct. 20 as well as over hopes for peace talks with the Taliban, which had grown following a three-day truce in June.

A senior Taliban official said the attack on a strategic city so close to the capital was intended as a demonstration that the insurgents held the upper hand on the battlefield, which would strengthen their position in talks.

“We wanted to convey a message to the Americans, their allies and the puppet government in Afghanistan that if we want, we can target them anytime and anywhere,” he said.

Hundreds of people have been killed and wounded in the fighting, some of the heaviest seen in Afghanistan since the Taliban seized the northern city of Kunduz in 2015.

Government officials said nearly 100 members of the security forces have been killed while the U.S. military said it had carried out more than 30 air strikes that had killed more than 220 Taliban since Friday.

There have been no reliable estimates of civilian casualties but the city’s hospitals have been overwhelmed.

Slideshow ( 15 images )

“Bodies of Taliban fighters and police can be seen in the streets. I saw two bodies that were eaten by dogs,” said Abdul Hakim Sulaimankhel, 37, who owns an auto parts shop in Ghazni.

He said shops and a big carpet market had been burned out and a neighbor’s granddaughter had died of illness because her family could not take her to hospital.

“There is no bread and shops have all been destroyed. It will take months for it all to be rebuilt,” he said.

ATTACK IN NORTH

“The Taliban, who falsely and repeatedly claim that they do not target civilians, have executed innocents, destroyed homes, burned a market and created the conditions for a potential humanitarian crisis with this attack,” Lt. Col. Martin O’Donnell, spokesman for U.S. Forces-Afghanistan.

He said some Taliban fighters remained in the city but did not pose a threat and clearing operations were underway by Afghan forces.

While the security forces appeared to reassert control over Ghazni, the Taliban attacked and seized large parts of an army base in the northern province of Faryab, killing at least 10 soldiers and capturing dozens over two days of clashes, officials said.

Mohammad Tahir Rahmani, head of the Faryab provincial council, said the insurgents had seized tanks and ammunition.

“We have not been able to enter the base. Large parts of it are still under the Taliban control,” Rahmani said.

Another official in Faryab said the Taliban had captured 40 soldiers, while 30 militants had been killed.

The Taliban are fighting to expel foreign forces, topple the government and impose their version of hardline Islamic law 17 years after they were ousted by U.S.-backed forces.

The fighting has underlined the struggle security forces have been facing to confront the insurgents, who have steadily extended their control over the countryside even though they have been unable to take and hold a major city.

Western diplomats said the fighting raised questions about the viability of the U.S. strategy to end the war, which for the past year has focused on pressing the militants, largely with more air strikes, to force them to the negotiating table.

An unprecedented three-day truce during the Eid al-Fitr holiday in June and a meeting between a senior U.S. diplomat and Taliban representatives in Doha had raised hopes of further moves but the fighting in Ghazni had dampened optimism.

“The Taliban are asserting themselves on the battlefield even as U.S. officials talk of hopes for peace. War and peace talks cannot happen together,” said one diplomat in Kabul.

Ghazni parliamentarian Chaman Shah Etemadi said the events in Ghazni would destroy confidence in a government which had proved incapable of providing security.

“It doesn’t make much difference if government troops secure full control of Ghazni, it is a disaster - destruction, burned out buildings and panic,” he said. It will be impossible to encourage people to take part in democratic processes like elections.”