Taliban insurgents unleashed a fresh wave of attacks across Afghanistan this week, overrunning at least two Afghan military bases and launching a sustained attack on a key city, in a multifront show of strength that left hundreds dead and threatened to upend recently begun peace talks with Washington.

As recently as last month, it appeared efforts to end the war were gaining traction, amid reports that American and Taliban officials had held a series of initial meetings in Qatar. The talks had followed a three-day cease-fire in June between the Taliban, the U.S. and the Afghan government.

But starting last week, the Taliban mounted a nationwide offensive, beginning with an attack on the strategic city of Ghazni, less than 100 kilometers from the capital, Kabul. After days of fighting, U.S. and Afghan forces appeared to regain control of most parts of the city. But the attack left as many as 500 people dead, destroyed much of Ghazni's infrastructure, and again exposed Kabul's security vulnerabilities.

The Taliban then overran two Afghan military bases in the northern provinces of Faryab and Baghlan, killing or capturing dozens of government forces. Insurgents also conducted major attacks in the provinces of Zabul, Kandahar, Helmand and Uruzgan. Separately, an Islamic State suicide attack on a school killed at least 34 people Wednesday in a Shiite neighborhood of Kabul.

'Upping the ante'

Pentagon chief Jim Mattis played down the importance of the Ghazni attack, insisting the Taliban failed to seize any territory in what he called "principally an information operation to grab a lot of press attention."

"This is what we've seen before in insurgencies, when there's going to be a negotiation or a cease-fire, [insurgents] try to up the ante. This enemy does it by murdering innocent people," Mattis said.

It's not clear whether the Taliban offensive will derail talks with Washington, which are still in the very early stages. Several reports suggest the Taliban-U.S. discussions are preparatory in nature, essentially talks about future peace talks. But that still may represent progress, as the U.S. appears to be relaxing its opposition to the Taliban's demand that it negotiates only with the Americans, not the Afghan government.

"[The Taliban] want to gain as much territory as they can and make sure militarily they're in a secure position" in case the talks move to a more advanced stage, said Omar Samad, a former Afghan ambassador to Canada and France.

'They believe they are winning'

But it's far from certain that the Taliban is interested in genuine peace talks, says Seth Jones, a former senior Pentagon official in Afghanistan who is now with the Center for Strategic and International Studies.

"They are willing to talk — that's pretty common in any insurgency. But to seriously sit down and negotiate, I see no evidence of that right now," said Jones, who added he's been in contact with Afghan and U.S. officials involved in the preparatory discussions with the Taliban.

"This is just the prosecution of a war. What we've seen in the last couple years is the Taliban trying to focus on urban areas they consider vulnerable. We saw it in Kunduz two years ago and I think in the case of Ghazni this was an attempt to take districts around the city and then to push in fighters," Jones said.

Although the Taliban often attack key cities, they have been unable to control urban areas for longer than a few days or even hours before being repelled, often with the help of U.S. airstrikes, as in Ghazni.

As of May, the Taliban controlled or influenced 19 percent of Afghan territory, mostly rural areas, according to U.S. military figures, while 22 percent of the country is contested.

U.S. military officials call the war a stalemate. But the Taliban's battlefield successes may be incentive enough to keep fighting, says Thomas Johnson, an Afghanistan specialist who teaches national security affairs at the Naval Postgraduate School in Monterey, California.

"I don't believe the Taliban are interested in sincere negotiations. They believe they are winning," said Johnson, author of the book Taliban Narratives.

Intel failure

The ongoing violence is a further blow to the government of Afghan President Ashraf Ghani, just months ahead of a parliamentary election. The Ghazni attack was particularly embarrassing, as the government apparently failed to act on months of repeated warnings of Taliban fighters massing in the area.

"This was a major intel, plus security failure," said one Afghan government official in Kabul, who did not wish to be identified because he was not authorized to comment on the matter. "People think that Taliban want leverage for the negotiations. But the fact is, that the country still remains fragile."

The violence comes almost exactly a year after the White House announced its new Afghanistan strategy. Under the new strategy, the U.S. military no longer will impose timelines for withdrawal, an approach that effectively commits the U.S. indefinitely to the conflict.

The plan also involves a massive surge in airstrikes. Through the first half of 2018, the U.S.-led coalition has dropped more bombs on Afghanistan than any other year stretching back to 2004, according to publicly available Pentagon data.

But the biggest problem with the U.S. strategy, according to Jones, is that the Trump administration has not been able to persuade Pakistan to end its support for Afghan militants.

"The U.S. has really done nothing to dislodge the Taliban's sanctuary in Pakistan. They have an entire leadership structure on the other side of the border," he said.

Pakistan's role in the conflict resurfaced again this week, when Afghan officials reported finding Pakistanis and other foreign fighters among the dead insurgents in Ghazni. Islamabad has denied playing any role in the Ghazni attacks.

"We are all outraged," said Wazhma Frogh, a women's rights activist and member of Afghanistan's High Peace Council. She says the Taliban wouldn't be able to carry out such sophisticated attacks without the help of Pakistan. Unless the trajectory of the conflict changes, Frogh says, many are concerned Afghanistan will return to a level of violence not seen since the 1990s civil war.

But with the Taliban seemingly determined to fight on, and the U.S. insisting it is digging in for the long-term, it's not clear things will change anytime soon.