Australians are being told to leave the Libyan city of Benghazi as soon as possible after Britain warned of a "specific and imminent" terrorist threat to Westerners.

The office of Foreign Minister Bob Carr says contact has been made with the two Australians registered as being in Benghazi.

Australian embassy staff in Cairo called them this morning and told them to leave the city as soon as they can.

Britain, Germany and the Netherlands are also warning their citizens to leave at once.

The warnings come after the British Foreign Office said it had received "credible" and "serious" reports about a possible terrorist threat to Westerners in Benghazi.

It declined to give details about the nature of the threat.

The Libyan government says it is very surprised by the warnings.

"Nothing justifies this reaction," deputy interior minister Abdullah Massoud said.

"We acknowledge that there are security problems in Benghazi and that there have been for several months, but there is no new intelligence that could justify this reaction from London."

He added that such actions only add to the region's instability.

Benghazi was the cradle of the 2011 revolution that toppled former Libyan leader Moamar Gaddafi.

Retaliatory attacks

An attack on the US mission in Benghazi last September killed four Americans, including US ambassador Chris Stevens. ( AFP )

The warning comes a day after US secretary of state Hillary Clinton gave an emotional appearance before Congress about the attack on the American mission in Benghazi last year.

United States ambassador Chris Stevens and three other Americans died in last September's attack, which was part of a wave of violence targeting foreign diplomats, military and police officers.

After France's recent military intervention in Mali and the Algerian hostage drama, governments are warning there could be retaliatory attacks against Western interests.

British prime minister David Cameron has warned that last week's deadly attack in Algeria was only one part of what would be a "long struggle against murderous terrorists" around the world.

Dozens of foreigners were killed when Islamist gunmen attacked a remote desert gas complex at In Amenas, including at least three Britons.

Space to play or pause, M to mute, left and right arrows to seek, up and down arrows for volume. Listen Duration: 3 minutes 9 seconds 3 m 9 s AM speaks with North Africa expert Download 1.5 MB

Another three workers, plus a British resident, are still missing and believed to be dead.

In a speech at the World Economic Forum in Davos, Mr Cameron promised to put the issue of terrorism at the top of the agenda at the G8 summit in Northern Ireland in June.

"I believe we are in the midst of a long struggle against murderous terrorists and the poisonous ideology that supports them," he said.

"As we have successfully put pressure on Al Qaeda in Afghanistan and Pakistan, so Al Qaeda franchises have been growing for years in Yemen, Somalia and parts of North Africa - places that have suffered hideously through hostage-taking, terrorism and crime.

"To defeat this menace, we've got to be tough, intelligent and patient - and this is the argument I'll be making at the G8."

Italy temporarily closed its consulate in Benghazi earlier this month and pulled its staff out of the country following a failed gun attack on the consul.

Libya has been awash with weapons since the fall of Gaddafi, and its shaky nascent institutions have struggled to rein in armed groups keen on ensuring they receive what they see as their fair share of power.

Benghazi in particular has been the scene of power struggles between various armed Islamist factions.

ABC/wires