The US Consulate in Benghazi in flames after an attack in September (Reuters)

The UK foreign office has urged all British nationals to leave "immediately" the city of Benghazi in Libya, due to a "specific and imminent threat to Westerners."

"Since September 2012, the Foreign Office has clearly advised against all travel to Benghazi and all areas of Libya, with the exception of Tripoli, Zuwara, Az Zawiya, al Khums, Zlitan and Misrata, and the coastal towns from Ras Lanuf to the Egyptian Border," the British foreign office said.

"We are now aware of a specific and imminent threat to Westerners in Benghazi, and urge any British nationals who remain there against our advice to leave immediately."

The Foreign Office hasn't provided further details on the nature of the threat.

The UK embassy in Libya is contacting Britons in Benghazi to alert them of the danger.

The Foreign Office travel advice bulletin for Libya says: "there is a high threat from terrorism" and "a threat of kidnapping".

"Following French military intervention in Mali, there is a possibility of retaliatory attacks targeting Western interests in the region. We advise vigilance" the travel advice says.

The British consulate in the north-eastern town closed in June last year after a convoy carrying UK ambassador to Libya Dominic Asquith was hit by a rocket-propelled grenade in the city's streets.

Asquith's escaped uninjured but two members of British security officers were hurt.

Italy has shut down its compound in Benghazi and pulled its staff out of the country after the consul was targeted in a similar attack, earlier this month.

Guido De Sanctis's bullet-proof car came under gunfire coming from a running car passing at a crossroad, in what Italian Foreign Minister Giulio Terzi described as "a vile act of terrorism".