Algeria has closed its embassy and its consulate in Tripoli because of a "real and imminent threat" to its diplomats, the foreign ministry announced on Friday, The Daily Star reported.
The decision was taken in coordination with the Libyan authorities, after information was received "about the existence of a real and imminent threat targeting our diplomats and consular staff."
The ministry said the "temporary measure" was "dictated by the difficult security conditions" in Libya, while emphasising Algeria's support for the authorities in Tripoli and their "efforts to build the rule of law and establish peace and security throughout the country."
Libya has suffered a series of attacks on its leaders and foreign diplomats in the increasingly lawless North African country, three years after NATO-backed rebels ended Moamer Kadhafi's four-decade dictatorship.
The Jordanian ambassador Fawaz Aitan was seized in April by masked gunmen as he was being driven to work in Tripoli. They shot at his car and wounded his driver.
Aitan was freed and flown home on Tuesday in an exchange for a Libyan jihadist jailed in Jordan for plotting bomb attacks.
Diplomats in Tripoli say militias which fought to topple Kadhafi in 2011 often carry out kidnappings to pressure foreign governments into releasing Libyans held abroad.
Libya's central government has struggled to assert its control over the vast, mostly desert country, which is awash with heavy weapons and effectively ruled by a patchwork of former rebel militias.
In March, the authorities acknowledged for the first time the existence of "terrorist groups", particularly in Benghazi but also elsewhere in the east.