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.
Aitan was freed and flown home on Tuesday in an exchange for a Libyan jihadist jailed in Jordan for plotting bomb attacks.
Also Read
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.