At least nine people have died and dozens more have been injured in a suicide car bomb attack in Afghanistan.

The target was the Indian consulate in the eastern Afghan capital of Jalalabad.

Gunfire was heard through the area for at least an hour following the 10am blast near the entrance.

All the casualties, except a wounded Afghan soldier, were civilians with most coming from a neighbouring mosque.  

An official said all Indian consular staff were safe. 

The blast follows a world-wide travel alert issued by the US, warning that al Qaeda could be planning attacks in August, particularly in the Middle East and North Africa.

Washington has ordered the closure of 21 embassies and consulates on Sunday, including its Kabul mission.

The eastern Afghan province and its capital Jalalabad have long been a hotbed of insurgent activity.

Dozens of Afghan police and insurgents died in a five-hour battle between Afghan security forces and Taliban fighters in the province yesterday. 

A local police spokesman said the bomber detonated a car packed with explosives outside the consulate and an adjacent mosque.

He said the Indian diplomatic mission was the intended target but most casualties were from the mosque.

Indian diplomatic missions have been targets of previous attacks in Afghanistan.