(Adds details, background)
TRIPOLI, July 10 (Reuters) - The United Nations has evacuated dozens of foreign staff from its mission in Libya due to a deteriorating security situation in the North African country, a U.N. spokesman said on Thursday.
"They will return if the security situation improves," said Samir Ghattas, spokesman for the U.N. Support Mission in Libya (UNSMIL), without saying how many had left the country.
Libya has been in a state of near constant turmoil for three years, with successive governments struggling for legitimacy and unable to tame various armed groups that helped overthrow veteran ruler Muammar Gaddafi in 2011 but are now defying state authority.
Ghattas gave no specific security reason for the evacuation.
Last month the U.N. mission, which is tasked with helping Libya to make the transition to democracy, drew sharp criticism over an initiative to bring together Libya's political factions.
The government complained that the world body had failed to consult with Libyan partners before announcing it. The U.N. initiative also drew anger and even threats on social media, prompting Tripoli to urge citizens not to resort to violence against UNSMIL or the U.N. special envoy to Libya, Tarek Mitri.
Two years ago, there was an unsuccessful assassination attempt against the then-U.N. special envoy, Ian Martin. (Reporting by Feras Bosalum; Writing by Ulf Laessing; Editing by Gareth Jones)