(Recasts with Libyan comments, details, changes dateline)
By Ayman al-Sahli and Lesley Wroughton
SABRATHA Libya/WASHINGTON Dec 28 (Reuters) - Four American military personnel were briefly detained in western Libya on Friday after part of their convoy failed to stop at a checkpoint and was found to be carrying weapons, Libyan officials said.
The Americans were released several hours later and brought to the capital Tripoli, U.S. and Libyan officials said on Saturday.
A U.S. defense official said the four Americans appeared to have been checking potential evacuation routes for diplomats at the U.S. embassy in Tripoli.
U.S. and other Western embassies have beefed up security at their missions in Libya, which is still in turmoil two and a half years after the fall of Muammar Gaddafi.
The military personnel were near Sabratha, a town located 70 km (45 miles) west of Tripoli, "as part of security preparedness efforts when they were taken into custody," State Department spokeswoman Jen Psaki said in a statement.
Libyan security forces stopped a three-car convoy belonging to the U.S. embassy in al-Ajailat west of Tripoli late on Friday, police said. One vehicle had no number plates.
"When the (first) car was stopped the two others escaped," Abdel-Fatah Salah, head of a regional police unit, told Reuters TV.
One of the fleeing cars later caused a traffic accident in nearby Sabratha. "When police arrived they found two armed diplomats," he said. The third car disappeared into the night.
The white four-wheel jeep stopped after the accident then suddenly caught fire which authorities could not explain, said al-Taher al-Gharbali, an army colonel in the local military council.
A Reuters photographer who arrived later at the scene saw a burned-out vehicle.
Once their identity had been established by the U.S. embassy the Americans were driven to Tripoli, officials said.
Passport pictures said to belong to the four were posted on Twitter. Neither the identity of the Americans nor the authenticity of those photos could be confirmed. A Libyan security source said one of the Americans was of Libyan origin and another carried a second passport.
Psaki said the United States, which backed the 2011 uprising against Muammar Gaddafi, valued its relationship with "the new Libya".
The North African country is still in turmoil, with widespread insecurity, rival militias and a burgeoning autonomy movement in the country's east.
The detention of the Americans takes on greater significance because of the militant attack in Benghazi on Sept. 11, 2012, in which U.S. Ambassador Chris Stevens and three other Americans were killed.
The attacks touched off a political storm in Washington, with Republicans accusing Obama's administration of telling shifting stories about who was behind the attacks.
In October, U.S. forces seized Nazih al-Ragye, better known by the cover name Abu Anas al-Liby, in Tripoli in connection with the bombings of U.S. embassies in Kenya and Tanzania in 1998. (Reporting by Lesley Wroughton, Missy Ryan, Ghaith Shennib, Ulf Laessing and Ayman al-Sahli; Writing by Ulf Laessing and Lesely Wroughton; Editing by Rosalind Russell and Erica Billingham)