An Italian consul has come under fire in his car in the eastern Libyan city of Benghazi but was unhurt, the Italian Foreign Ministry said.

"He is completely unharmed," said the spokesman on Saturday.

"They shot at his car, but the car was armoured. He is fine, there are no injuries," a security source in Libya who declined to be named told the Retuers news agency.

The consul, Guido de Sanctis, is based in Benghazi.

Security for Westerners in Libya's second city has been an acute concern since the US ambassador was killed along with three other US embassy staff in an assault on the US consulate in the city on the anniversary of the September 11 attacks.

Hot spot for violence

A police source in Benghazi said the shots had been fired from a car passing De Sanctis's residence. A Reuters reporter saw two bullet holes in the building, which was surrounded by police.

The Italian spokesman said security around officials in Benghazi was already high before Saturday's attack.

The city was where the anti-Gaddafi uprising broke out in February 2011. But Libya's new elected rulers in Tripoli have struggled to impose their authority on a country where armed groups wield the real power, and Benghazi's multitude of armed factions now make it a hot spot for violence.

In November, the city's police chief was shot dead. And last June, a convoy carrying the British ambassador was attacked with a rocket-propelled grenade that injured two of his bodyguards.

The offices of the International Committee of the Red Cross in the city were also attacked last year, as was a convoy carrying the United Nations' former special envoy to Libya.