Kabul - Taliban militants attacked the US consulate in western Afghanistan on Friday morning, using a car bomb and guns to battle security forces just outside the compound in the city of Herat.
It was not entirely clear whether any attackers managed to breach the facility, but at least two Afghans died, while the US said its personnel were all safe.
The attack, which also injured several people and wound up leaving five alleged militants dead, underscored the perilous security situation in Afghanistan, where US-led troops are reducing their presence ahead of a full withdrawal next year.
The insurgent strikes are no longer concentrated in the country's south and east, but occur with troubling frequency in the north and west, which have been the more peaceful areas in years past.
Friday's assault - which was claimed by the Taliban - also followed a day and a half of exceptional joy in Afghanistan, as people of all backgrounds celebrated their nation's first international soccer championship.
Afghan and US officials offered slightly different accounts of what happened.
According to Herat province officials, the attack began around 06:00 with a powerful explosion caused by a suicide car bomber some 60m from the front gate of the consulate compound. Fellow militants then engaged in a fire fight with security forces in the area.
US State Department spokesperson Marie Harf said the assault began around 05:30, when "a truck carrying attackers drove to the front gate, and attackers - possibly firing rocket propelled grenades and assault rifles - commenced attacking Afghan Protective forces on the exterior of the gates and contracted security guards. Shortly after, the entire truck exploded, extensively damaging the front gate."
General Rahmatullah Safi, the province's chief of police, said US special forces entered the area to secure the compound, and that no attackers managed to breach it. Harf's statement said "American security personnel" were among the response team, and added that "it appears American and contract security personnel addressed any attackers who managed to enter the compound".
Footage broadcast on Afghanistan's Tolo television network showed Afghan police dragging away a badly bloodied person from the scene, but it was unclear if he was dead or who he was. Rubble and twisted pieces of metal lay strewn in a seemingly wide area near the consulate, the footage showed.
Safi, chief of police in Herat province, initially said an Afghan translator who apparently worked for the consulate died in the attack, but later said that victim was more likely a private security guard working at the compound. An Afghan police officer also was killed, while an unclear number of police, guards and civilians were wounded.
Safi said four militants were killed during the assault, as was the suicide car bomber, but the situation was under control around an hour after the start of the attack.
Robert Hilton, a US Embassy spokesperson, said that he had no information about a translator being among the victims and that "all consulate personnel are safe and accounted for".
Herat lies near Afghanistan's border with Iran and is considered one of the better developed cities in the country, with a strong Iranian influence. The US consulate is located in a relatively sparsely populated part of the city, and the attack took place on Friday, a day of rest in the country.
The Taliban strike was, nonetheless, a stark reminder of the challenges facing Afghanistan, where people had been basking in a rare moment of national unity and joy.
On Wednesday and Thursday, Afghans of all ethnicities and ages had poured into the streets to celebrate the national soccer team's 2-0 defeat of India in the South Asian Football Federation Championship.