KABUL, Afghanistan — An attack in the western city of Herat that killed seven people and wounded 20 on Friday morning underscored the continued fragility of the security situation in the country, even in pockets of Afghanistan long considered peaceful.

The attack began around 5:30 a.m. when a group of five suicide bombers detonated a van full of explosives near the auxiliary gate of the American Consulate, according to the office of the governor of Herat Province. As many as 20 civilians in the area were also sent to hospitals for treatment, said Sayed Wahid Qattali, the head of the provincial council.

After the explosion, which shattered the glass of the consulate building and structures in the surrounding area, attackers mounted an assault on the consulate. An hourlong firefight resulted in the deaths of several insurgents, who were unable to breach the gate, according to provincial and police officials. American security personnel helped fight off attackers who tried to enter the compound, according to a statement from the State Department.