Four American military personnel were detained by the Libyan government on Friday and held in custody for several hours before being released, US officials said.
The Americans were near Sabratha, a town located some 70 km (45 miles) west of Tripoli that is home to well-known Roman ruins, "as part of security preparedness efforts when they were taken into custody," State Department spokeswoman Jen Psaki said in a statement.
A US defense official said the four Americans appeared to have been checking potential evacuation routes for diplomats at the US embassy in Tripoli.
There was no immediate Libyan reaction. State news agency Lana only carried Psaki's statement, which confirmed the Americans' release, while the interior and defence ministries could not be reached.
A Libyan security source said the Americans had been travelling in two cars, one of which was stopped at a checkpoint near al-Ajailat, south of Sabratha.
A Reuters photographer who arrived later at the scene saw a burned out, four-wheel drive vehicle.
"Their car burned out," the security source said. A police official told the photographer the car was set on fire after the arrest, but did not explain the circumstances.
The Americans' second car was stopped by security forces close to Sabratha, a coastal town, the Libyan source 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. The 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".
"We have a strategic partnership based on shared interests and our strong support for Libya's historic democratic transition," she said.
More than two years after the collapse of Gaddafi's rule, 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 US 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, US forces seized Nazih al-Ragye, better known by the cover name Abu Anas al-Liby, in Tripoli in connection with the bombings of US embassies in Kenya and Tanzania in 1998.