The United States evacuated all its staff from its embassy in Libya on Saturday due to the fierce fighting in the capital, US officials said.
Although the embassy had already been operating on limited staffing, the remaining team drove overland under heavy military guard to Tunisia hours after the Libyan government warned the country could be torn apart by clashes between rival militias for control of Tripoli airport.
"Due to the ongoing violence resulting from clashes between Libyan militias in the immediate vicinity of the US Embassy in Tripoli, we have temporarily relocated all of our personnel out of Libya," deputy State Department spokeswoman Marie Harf said in a statement.
"We are committed to supporting the Libyan people during this challenging time, and are currently exploring options for a permanent return to Tripoli as soon as the security situation on the ground improves."
Harf added that in the meantime "staff will operate from Washington and other posts in the region."
The State Department also issued an updated travel warning cautioning Americans against traveling to Libya, and urging all those in the country to "depart immediately."
Fresh clashes broke out Friday between rival Libyan militias battling for control of Tripoli airport, the target of 13 days of shelling that have disrupted air links to the outside world.
"Regrettably, we had to take this step because the location of our embassy is in very close proximity to intense fighting and ongoing violence between armed Libyan factions," Harf said.
She confirmed that the embassy staff had "traveled overland" and had arrived in Tunisia early Saturday and were "traveling onward from there."
"We are grateful to the government of Tunisia for its cooperation and support."
F-16 fighters and Osprey aircraft provided security during the five-hour drive to Tunisia and there were no incidents.
The United Nations has already pulled its staff out of the North African state, and Turkey has suspended its embassy operations because of the violence in Tripoli. Turkey has removed about 700 personnel from the country.
Memories are still raw for many Americans of the 2012 militant attack on the US mission in eastern Benghazi when the ambassador Chris Stevens and three other American personnel were killed.
The attack roiled the US political landscape, and Republicans still accuse the US administration of seeking to cover-up the true events of the assault by dozens of armed Islamic militants.
Libya's main international airport has been shut since fighting erupted on July 13, in violence that has killed at least 47 people and wounded 120, according to the Libyan health ministry.
The clashes, the most violent since the overthrow of dictator Moamer Kadhafi in 2011, started with an assault on the airport by a coalition of groups, mainly Islamists, which has since been backed by fighters from third city Misrata.
Agence France-Presse and Thomson Reuters contributed to this report.