Dozens of Afghans were killed Monday morning and more than 105 injured in a brazen strike by Taliban militants on a security compound in the heart of Kabul, officials said, dimming hopes for a new round of U.S.-Taliban peace talks in Qatar that began Saturday.

Security officials said all the attackers were killed by late afternoon after an eight-hour gun battle that shut down the Afghan capital when a truck bomb exploded outside the Ministry of Defense, and five heavily armed insurgents managed to enter the compound. 

The Taliban quickly claimed responsibility for the attack, which officials said had left up to 40 people dead, many of them members of the security forces. There was no public confirmation of that casualty number. Only three soldiers and one civilian have been officially confirmed dead. Health officials also said half of those wounded were children at two schools near the blast site.

Reports from Doha, the Qatari capital where a new round of peace talks is underway, indicated that expected progress had been set back by the attack in Kabul, coupled with continued Taliban insistence that all U.S. forces leave Afghanistan before the insurgents would agree to negotiate with any other Afghans.

Just days ago, U.S. negotiators expressed high hopes for the seventh round of talks since September, which were expected to focus on an arrangement for U.S. troops to pull out gradually while other issues were discussed and Afghan officials or other leaders might be able to join the talks. Secretary of State Mike Pompeo said Tuesday that he hoped a full peace deal could be reached by Sept. 1.

But that optimism appeared to fade quickly as insurgent negotiators demurred on the withdrawal conditions over the weekend, observers in Doha reported, and soured further as news of the aggressive Kabul attack Monday reached the talks. 

Afghans carry a dead body after a car bomb blast near a governmental institution in downtown Kabul on July 1. (Hedayatullah Amid/EPA-EFE/Shutterstock)

“The latest attack by the Taliban has changed the entire context of our meeting. Unease has crept in,” an official present at the negotiations told the Reuters news service Monday. Western officials told CBS that the top U.S. negotiator, Zalmay Khalilzad, planned to return to Washington because the insurgents had not shown enough flexibility in their demands.

Until now, Khalilzad has been relentlessly upbeat about the talks. He recently suggested that a breakthrough was in the offing, and said that “all sides are ready for peace.” There was added urgency on the U.S. side to reach some agreement on troop withdrawals and talks with Afghan officials before Afghan presidential election planned for late September.

But Taliban officials also dampened those expectations Monday. In a tweet, Taliban spokesman Sohail Shaheen said that when a withdrawal timetable is “announced in the presence of international representatives, then we will start negotiations with Afghan side, but we will not talk with the Kabul administration as a government.”

Both Taliban fighters and Afghan forces have been stepping up their attacks across the country in recent months, leading to sustained casualties among security forces and civilians. On Sunday, Taliban fighters using four Humvees launched suicide attacks on government buildings in southern Kandahar, killing dozens of security forces and eight election workers.

There have also been periodic Taliban bombings and attacks in Kabul this year, but none since May 8, when insurgents attacked a building occupied by a U.S.-supported international development agency, killing five people and wounding 25.

Monday’s attack began with a powerful truck bomb explosion outside the Defense Ministry, located in a densely populated part of the city with shops, schools and mosques nearby. It was rush hour, and the streets were packed. A group of assailants entered a building in the multi-acre compound, sparking a protracted gun battle with police and security forces that was punctuated by explosions.

The violence shut down major streets for hours, as victims were rushed to hospitals across the city. Many schoolchildren were treated for injuries from shattered glass, and some schools were locked down. One boy being taken away for treatment was shown on TV news reports, his hands clutching his pencil and notebook and his face in shock.

Zabiullah Mujahid, a spokesman for the Taliban, said that civilians were hurt by the car bomb, but he said the intended target was the military facility. But some Kabul residents, worried and angry, asked why the United States was holding peace talks amid such deadly attacks.

“The Taliban are negotiating with foreigners abroad, but they are killing us here,” a carpenter named Hashmatullah, 28, told an Afghan TV news station. 

Constable reported from Islamabad, Pakistan.