KABUL, Afghanistan — Heavily armed Taliban attackers in minivans packed with explosives struck the headquarters of the Afghan intelligence agency on Wednesday, detonating one of the vehicles in one of the most secure parts of Kabul and escalating a growing conflict between the two entities.

The explosion went off around noon near one of the gates at the headquarters, killing one agent and wounding at least 30 civilians, some of whom could be seen staggering down the street, covered in blood. A second vehicle, filled with explosives and five gunmen, was stopped by guards, who killed the insurgents and managed to defuse the bomb three minutes before it was set to detonate, officials said.

The bombing was the latest salvo in a pitched battle between the Taliban and the Afghan intelligence agency, officially named the National Directorate of Security.

Over the past two days, Taliban fighters have claimed responsibility for the deaths of four of the agency’s guards across the country. On Wednesday, in addition to the attack in Kabul, two agency guards died while trying to defuse a roadside bomb in Tarinkot, the capital of Oruzgan Province. And on Tuesday, an agency guard was gunned down there by attackers on a motorcycle.