Italy has closed its embassy in Tripoli and repatriated its staff amid ongoing violence in Libya.
The Italian diplomatic corps there was one of the last remaining European missions.
Parallel governments and multiple armed militias are locked in an ongoing and deadly power struggle since the death of leader Moammar Gadhafi in 2011.
"The deteriorating situation in Libya made it necessary to close (the embassy)," Italy's Foreign Minister Paolo Gentiloni said in a statement.
In the early part of the 20th century Italy was the colonial power in Libya and it still follows Libyan affairs closely.
Struggle against IS
Meanwhile, officials of Libya's rival governments have been in touch over the growing threat of Islamic State militants, a top Libyan security official said, suggesting the fight against a common enemy might help to unite the country's warring factions.
Western governments worry that Islamist militants are exploiting the discord.
Several groups in Libya have declared their allegiance to the Islamic State group, whose jihadists have taken over large swaths of Iraq and Syria they claim as their own Islamic caliphate.
Fighters claiming ties to the Islamic State group in Libya said they carried out an attack on Tripoli's Corinthia Hotel last month, when gunmen shot nine people, including an American security adviser and a Frenchman.
“Islamic State is a big, big threat,” said Omar al-Zanki, the interior minister in the official government.
Prime Minister Abdullah al-Thinni suspended Zanki for criticism of former general Khalifa Haftar, but Zanki said he continues to command troops, pending the outcome of a legal complaint over his case.
Zanki blamed supporters of Islamic State militants in Iraq and Syria for the storming of government buildings in the central city of Sirte this week. State media had made the incident public on Sunday without releasing details.
Zanki estimated around 1,000 militants were based in Sirte.
Thinni's government in eastern Libya has accused Islamist politicians tied to the rival government in Tripoli of supporting militants, a charge they reject.
But Zanki said some officials in the Tripoli-based government had made contact, and were realizing they could no longer ignore the Islamic State threat. Others in the Tripoli government have blamed former Gadhafi supporters for recent attacks such as the Corinthia assault.
“There are no doubts that we've had contacts with the western region and especially Misrata, about the big threat of Islamic State,” Zanki said, referring to the Misrata city, a power base for the forces controlling Tripoli.