The United States evacuated its embassy in Libya on Saturday, driving diplomats across the border into Tunisia under heavy military escort after escalating clashes broke out between rival militias in Tripoli.
Security in the Libyan capital has deteriorated following two weeks of fighting between brigades of former rebel fighters who have pounded each other with rockets and artillery fire in southern Tripoli near the embassy compound.
The violence is the worst seen in Tripoli since the 2011 fall of Muammar Gaddafi. Western governments fear Libya is teetering toward becoming a failed state just three years after the NATO-backed war ended his one-man rule.
Three F-16 fighters provided air support and Osprey aircraft carrying Marines flew overhead the U.S. convoy as a precaution, but there were no incidents during the five-hour drive from Tripoli to Tunisia, U.S. officials said.
"Security has to come first. 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,'' a U.S. State Department spokeswoman Marie Harf said in a statement.
Since one militia attacked Tripoli airport two weeks ago, fighting has killed at least 50 people, shut down most international flights and forced the United Nations and Turkey to pull out their diplomatic staff.
Speaking to reporters in Paris before holding talks on the Middle East, U.S. Secretary of State John Kerry described Libya's situation of "free-wheeling militia violence'' as a real risk to U.S. staff with clashes around the embassy.
The battle for control of Tripoli International Airport is the latest eruption in a rivalry among bands of ex-fighters who once battled side by side against Gaddafi. Since then, they have turned against each other in the scramble for control.
Since the 2011 fall of Tripoli, fighters from the western town of Zintan and allies have controlled the area including the international airport, while rivals loyal to the port city of Misrata entrenched themselves in other parts of the capital.
Tripoli was generally quieter after the evacuation. But sporadic clashes broke out again near the embassy around the airport road with militias firing anti-aircraft guns mounted on pickup trucks, a Reuters witness at the scene said.
At least 10 people were also killed and 50 more injured in clashes between Libyan special forces and Islamist militants who are entrenched in the eastern city of Benghazi, security and hospital sources said.
The State Department spokeswoman said embassy staff would return to Tripoli once it was deemed safe. Until then, embassy operations would be conducted from elsewhere in the region and Washington.
Security in Libya is an especially sensitive subject for the United States because of the Sept. 11, 2012, attack on the U.S. mission in Benghazi, in which militants killed Ambassador Chris Stevens and three other Americans.
Read MoreUkraine: What's the big disruption?
The attack also brought political fallout for President Barack Obama, with Republicans saying his administration did not provide sufficient overall security, did not respond quickly to the attack and then tried to cover up its shortcomings.
Ed Royce, Republican chairman of the House Committee on Foreign Affairs, told CNN on Saturday the administration needed to get "more engaged on the ground with the factions in Libya'' to help bring the violence under control.
"I think they're on the right track (now) but late into the game in terms of trying to bring factions together and use U.S. leverage in order to try to work this out,'' Royce said.
A Libyan militant suspected of involvement in the 2012 attack, Ahmed Abu Khatallah, was captured in Libya last month and brought to the United States. He has pleaded not guilty.
But three years after Gaddafi's demise, Libya's transition to democracy is faltering, and its fragile government and nascent armed forces are unable to impose authority over the brigades of former fighters.
Many ex-fighters on the government payroll as semi-official security forces, but often pay little heed to the central government, each brigade claiming to be a legitimate force and the successors of the 2011 revolution.
Heavily armed, they have sided with competing political forces vying to shape the future of Libya in the messy steps since the end of Gaddafi's four-decade rule.
Libya's Western partners fear the OPEC oil-producing country is becoming increasingly polarized between two main groupings of competing militia brigades and their political allies.
One side is grouped around Zintan and their Tripoli allies, the Qaaqaa and al-Sawaiq brigades, who are loosely tied to the National Forces Alliance political movement in the parliament.
Opposing them is a faction centered around the more Islamist-leaning Misrata brigades and allied militias who side with the Justice and Construction Party, a wing of the Muslim Brotherhood.