Herat. US and Afghan forces have fought off an attack by Taliban insurgents on the US consulate in the western city of Herat.
Two Afghan police and one security guard were killed in the dawn assault, along with four attackers. The US consulate said its staff were safe.
The Taliban said they carried out the attack, which began with a huge blast at the compound gates, sparking a gun battle near consulate buildings.
Attacks continue despite the planned withdrawal of foreign troops in 2014.
Seventeen civilians, including women and children, were injured in the Herat attack.
Herat sits close to the Iranian border on a vital trade route across southern Afghanistan and it has been relatively peaceful in recent years.
The US consulate in Herat was opened just four years ago in a former five-star hotel.
The BBC’s David Loyn in Kabul says this attack - carried out in the shadow of the anniversary of 9/11 - is a demonstration of the ability of insurgents still to disrupt Afghanistan 12 years after the US toppled the Taliban.
In violence elsewhere, a truck bomb exploded near government offices in the volatile south-eastern province of Paktika, injuring several Afghan security personnel.
The force of the explosions in Herat left the road badly damaged and pieces of twisted metal and rubble could be seen in the vicinity of the consulate, reports say.
An Afghan army spokesman told the BBC that a huge truck bomb damaged the outer defences of the US consulate, allowing the attackers to breach the perimeter and shoot at the consulate buildings. “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,” US State Department spokeswoman Marie Harf told reporters.
“Shortly after, the entire truck exploded, extensively damaging the front gate [to the consulate],” she added.
The gunfire continued for some time, reporters at the scene said.
The Nato-led International Security Assistance Force (Isaf) tweeted at 04:00 GMT that the consulate was secure “with all enemy forces being killed”. Isaf and Afghan National Security Forces were at the scene, it added.
Peter Bezaorowajnyj, who works in Afghanistan, told the BBC he could see smoke from the explosion from the roof of his building.
The explosion “rocked the building I am staying in”, he said.
Earlier this month Taliban targeted the Torkham US base in eastern Afghanistan, sparking a lengthy gun battle in which three insurgents were killed.