Kabul, Afghanistan (CNN) -- A huge explosion rocked the area near the U.S. consulate in Afghanistan's Herat province early Friday during a heavy gunfight between militants and security forces, officials said.
The attack occurred just before 6 a.m. local time when attackers sped towards the front gate of the consulate, said Marie Harf, a deputy State Department spokeswoman.
The attackers fired assault rifles starting a gun battle with Afghan security forces. During the battle, a truck exploded, Harf said, causing major damage to the front gate of the consulate.
American consulate personnel took shelter in safe havens while U.S. security forces responded to the attack, Harf said. There were no U.S. casualties.
Seven attackers traveling in two vehicles took part in the assault and all of them were killed, said Mohammad Ayoub Salangi, deputy Afghan Interior Minister.
Three people, two local police officers and a local security guard, were killed, police and hospital officials said. Twenty others were injured.
The Taliban claimed responsibility for the attack in an e-mail to CNN.