By Marie-Louise Gumuchian and Mohammed Abbas
TRIPOLI/LONDON (Reuters) - European countries urged their nationals to leave the eastern Libyan city of Benghazi on Thursday, with Britain citing a "specific and imminent" threat to Westerners days after a deadly attack by Islamist militants in neighboring Algeria.
Officials declined to give details, but Britain has warned of a growing militant threat in North Africa, which Prime Minister David Cameron has called a "magnet for jihadists".
The call to leave Libya's second largest city irked Libyans keen to win foreign investment to rebuild a fractured infrastructure and boost the oil industry after the revolution which toppled Muammar Gaddafi in 2011.
"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 said in a statement.
Similar warnings came from Germany and the Netherlands.
They followed the deaths of at least 38 hostages in an attack on Algeria's In Amenas gas complex near the Libyan border, and the start of French military operations in Mali.
German Foreign Minister Guido Westerwelle described the situation in Benghazi, cradle of the uprising against Gaddafi, as "serious and delicate".
"The warning was made because of a series of bits of information. We have our reasons, but I would not like to speak of details. Security is the most important thing," he told reporters during a visit to Lisbon.
Few Westerners are believed to be in Benghazi, which has experienced a wave of violence against diplomats as well as military and police officers, including an attack in September that killed the U.S. ambassador and three other Americans.
A British embassy spokeswoman in Tripoli said the number of Britons in Benghazi was small, without specifying further.
U.S. and European sources downplayed the risk to Americans, saying the threats were explicitly directed against European nationals.
Libyan deputy Interior Minister Omar al-Khadrawi said there were no more than 20 British nationals in Benghazi and most worked at international schools.
The principal of the British School Benghazi said he was told to close the school after a personal call from the British ambassador in Tripoli.
"He called each of the British nationals and said to get out now," Randy Robinson, 53, told Reuters.
"He sounded urgent. He just said there are threats of attacks on foreign institutions run by foreigners and that schools and hospitals are on the list."
Robinson, a Canadian, said the ambassador did not say who the threats were from because "that would jeopardize their source". The school has six British nationals, four of whom, he said, were trying to leave Libya.
"I am going to stay for a while. We will try to get the school going with the staff we have left, but it is a day-by-day situation," he said.
Last week Italy suspended activity at its Benghazi consulate and withdrew staff after a gun attack on its consul.
"The situation in Cyrenaica (eastern Libya) is not just worrying, it is incredibly worrying," a Western diplomat said. "But in light of the events recently, this could be a precautionary measure."
With the country awash with weapons and its shaky nascent institutions struggling to rein in armed groups, Libyans are keen to ensure Western fears do not drag down its economy.
The bulk of Libya's oil wealth, around 80 percent, is located in the east of the country, but the oil installations are far from Benghazi and oil is not piped through there.
"The British ambassador told me about this decision yesterday and I told him to give me reasons for this fear, and he said we have threats and fears for our people there. I asked him for something written, and he still hasn't provided it," deputy Interior Minister Khadrawi told Reuters.
"They have the right to be fearful for their people and it is our duty to protect them and our citizens. The threats they are speaking of, we are taking seriously. The British decision should have been taken together with the Libyan government."
Cameron's spokesman batted away accusations that Britain's warnings undermined confidence in Libya after Gaddafi and said that "progress can, is being made in Libya".
A LOT OF THREATS
Benghazi has been the scene of power struggles between various armed Islamist factions. U.S. intelligence officials say Islamist militants with ties to al Qaeda affiliates were most likely involved in the deadly September 11 assault on the U.S. mission in the city, Libya's second biggest.
Libya, whose vast desert borders are hard to police, fears that France's military operation in Mali could fan Islamist flames at home, and Libya's foreign minister called for United Nations peacekeepers to be deployed in Mali to prevent uprooted fighters destabilizing countries nearby.
Security experts said the European warnings were probably in response to threats from groups angered by the French operation in Mali and inspired by the attack at In Amenas.
One European national security official said "a lot of folks" were doing "a lot of threatening".
George Joffe, Middle East expert at Cambridge University, said a direct link between Islamist groups in Libya and those behind the Algeria attack was unlikely.
"I'm quite certain these are groups working in sympathy with other groups elsewhere (but), I don't think for one minute that there are organizational or institutional links between groups in Mali or in Algeria and those in Libya," Joffe said.
"The threats almost certainly come from an extremist group ... basically based in Benghazi, but we have no idea of the seriousness of the threat, the ability of the group to carry out the threat or the intention of the group in making it."
Saad al-Saitim, deputy head of the Benghazi Local Council, said the warnings were a setback, inciting "more fear at a time when people need to stand with us".
"Following the Mali events, foreigners are worried and are taking precautionary steps. Benghazi hardly has any foreigners at the moment and few foreign consulates," he said.
British Airways said it would continue operating its thrice-weekly flights from London to the Libyan capital Tripoli. The next one is scheduled for Sunday.
Air Malta said it had cancelled Thursday's flights to Benghazi following Britain's warning.
(Additional reporting by Rhys Jones, Mark Hosenball, Ali Shuaib in Tripoli and Ghaith Shennib in Benghazi; Daniel Alvarenga in Lisbon; and Mark Hosenball in Washington; Editing by Myra MacDonald, Jon Hemming and Eric Beech)