The US says it has temporarily evacuated its staff from the Libyan capital Tripoli over security concerns.
Staff, including marine guards providing security to the embassy, have been transferred to Tunisia “due to the ongoing violence resulting from clashes between Libyan militias,” it adds.
Secretary of State John Kerry said there was a “real risk” to staff.
It comes amid fierce clashes between rival militias in the capital, with intense fighting at Tripoli airport.
Libya has been gripped by instability since the 2011 uprising, with swathes of the country controlled by militias.
With no army, Libya’s central government has increasingly lost control over the country to rogue and powerful militias in the last two years, says the BBC’s Rana Jawad in Tripoli.
The US embassy in Tripoli was already operating on limited staffing. All remaining personnel were driven overland to Tunisia in the early hours of Saturday.
The US military said it had “assisted in the relocation” of embassy staff, using F-16 and MV-22 Osprey aircraft.
It said the five-hour operation was “conducted without incident”.
State department spokeswoman Marie Harf said the withdrawal “underscored the Obama administration’s concern about the heightened risk to American diplomats abroad”.
She said that fighting between rival armed groups was taking place “in very close proximity” to the US embassy in the capital.
The state department has also urged US nationals not to go to Libya.
It is the second time in more than three years that the US has closed its embassy in Libya.
Turkey has also withdrawn some 700 members of staff from Libya, Secretary of State John Kerry said.
Earlier this week, the UN also announced it was withdrawing all its staff from Libya.
US ambassador Christopher Stevens and three other Americans were killed in an attack on the US consulate in Benghazi in September 2012.
The US move comes one day after Libyan government officials warned of the possibility of a break up of the country if clashes over Tripoli airport continue.
Rival Libyan militias have been locked in battle at Libya’s main airport in the south of Tripoli since last week, forcing the airport to shut.
Members of the Islamist Libya Revolutionaries Operations Room (LROR) are trying to seize control of the airport, which has been in the hands of the Zintan militia since the toppling of Col Muammar Gaddafi in 2011.
Our correspondent in the capital says both militia groups are believed to be on the official payroll.
The government has been unable to disarm the numerous armed groups that took part in the 2011 uprising and which have divided the country.
The eastern city of Benghazi has also been wracked by fighting between a rogue general, Khalifa Haftar, and Islamist groups, while many oil fields remain in the hands of separatist groups.
Dozens of government officials and high-profile military figures have been the target of assassination attempts in the city over the last two years.