Four American military personnel have been released after being held for a few hours by the Libyan government.

State Department spokeswoman Jen Psaki said President Barack Obama's administration was looking into the incident, but confirmed that "all four US military personnel being held in Libyan government custody have been released."

A US defence official said the Americans appeared to have been checking possible evacuation routes for the U.S. embassy in Tripoli.

The Americans were near Sabratha, an area west of Tripoli that is home to well-known Roman ruins, "as part of security preparedness efforts when they were taken into custody," Psaki said in a statement.

Passport pictures said to belong to the four were posted on Twitter. The identity of the Americans or the authenticity of those photos could not be immediately confirmed.

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 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.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.