* US embassy staff travel to Tunisia under armed guard
* Kerry says militia violence posed threat to staff
* Security in Libya is sensitive issue after 2012 attack (Adds Kerry, more details, background)
By Patrick Markey
TRIPOLI, July 26 (Reuters) - The United States evacuated its embassy in Libya on Saturday, driving its staff under heavy military guard across the border to Tunisia 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 exchanged rocket, cannon 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. The 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.
F-16 fighters and Osprey aircraft carrying Marines provided security to 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.
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 State Department spokeswoman said staff would return to Tripoli once it was deemed safe. Until then, embassy operations would be conducted from elsewhere in the region and Washington.
Tripoli was quieter on Saturday after the U.S. evacuation, but at least 10 people were killed and 50 more injured in clashes between special forces and Islamist militants in the eastern city of Benghazi, security and hospital sources said.
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.
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.
The clashes for control of Tripoli International Airport are the latest eruption in a deepening rivalry among bands of ex-fighters who once battled side by side against Gaddafi, but have since 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.
Heavily armed, they have sided with competing political forces vying to shape the future of Libya in the messy transition 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 centred around the more Islamist-leaning Misrata brigades and allied militias who side with the Justice and Construction Party, a wing of the Muslim Brotherhood. (Additional reporting by Bill Trott and Phil Stewart in Washington, Arshad Mohammed in Paris; Editing by Gareth Jones)