Heavily armed Taliban fighters stormed the offices of a Virginia-based nonprofit group in central Kabul on Wednesday, sparking a five-hour gun battle with security forces, witnesses and government officials said.

Officials said two Afghan civilians were killed and about 20 were hospitalized with injuries. They also said about 80 people were rescued from the four-story building occupied by Counterpart International, a U.S. government-supported group headquartered in Arlington that promotes leadership, civic engagement and elections in foreign countries.

The Interior Ministry said that all of the assailants were killed. The total number of attackers was not immediately clear. The ministry said that five fighters may have joined the assault.

At least one foreigner was among the wounded, the Interior Ministry said, without identifying the person by name or nationality.

A Taliban spokesman, Zabiullah Mujahid, said in an email that the group’s office was targeted because it was engaged in “harmful Western activities” in the country. Mujahid also said the group had “implemented a dangerous program” that promoted “open intermixing between men and women.”

Afghan security forces guard the site of an explosion in Kabul on Wednesday. (Rahmat Gul/AP)

Counterpart’s website says the group has worked in Afghanistan since 2005. It describes the nonprofit group’s mission as working with local partners “to support stronger and more resilient communities by developing leaders, strengthening organizations, and fostering multi-sector community partnerships.”

The attack came days after Taliban insurgents resumed peace talks with U.S. officials in Qatar. A nationwide gathering of 3,000 Afghans last week called for an immediate cease-fire and an end to the 17-year war, but the Taliban said it had no intention of laying down its arms. 

During five years in power, the Taliban movement banned gender-mixing and prevented women from working or studying outside the home. Many Afghan women have expressed fears that a peace deal with the Taliban would allow the group to bring back such harsh religious rules. 

 Wednesday’s attack was the first claimed by the Taliban in Kabul in more than a month, but it came two weeks after armed men attacked a multistory government ministry in the city’s downtown. At least seven people were killed in the attack, and security forces had to evacuate hundreds of office workers before the assailants were slain. That attack was claimed by the Islamic State. 

During Wednesday’s attack, police said one vehicle laden with explosives and possibly driven by a suicide bomber was detonated outside Counterpart’s office in the upscale commercial Shahr-e Now district. 

Assailants equipped with rocket-propelled grenades and suicide vests then entered the building, where office employees were busy working. Several explosions were heard, and clouds of black smoke rose. 

Nasrat Rahimi, a spokesman for the Interior Ministry, said security forces rescued 80 employees who were trapped inside. Roads nearby were cordoned off. The initial explosion shattered hundreds of windows in nearby buildings. 

The United Nations mission in Afghanistan said it condemned “the Taliban’s deliberate targeting of a civilian aid organization.” The U.S. ambassador to Afghanistan, John R. Bass, denounced the attack as an act of “senseless violence.”

Pamela Constable in Islamabad, Pakistan, contributed to this report.