Four members of the United States military have been released after briefly being taken into custody by the government, US officials have said.

Earlier, the US State Department confirmed that the four were held by Libyan authorities and Washington was in touch with the Libyan government over the issue.

A US official with the Department of Defense told Associated Press news agency that the military personnel investigating potential evacuation routes in the town of Sabratha, located in some 80km away Tripoli, were taken into custody at a checkpoint on Friday.

They were detained briefly by the Libyan authorities before being released, the official said, adding that the military personnel were taken to the US Embassy in Tripoli after their release late on Friday.

Circumstances under which the four were detained remains unclear and no one was reported injured in the incident.

More than two years after the collapse of former leader Muammar Gaddafi's government, the country remains in turmoil with widespread insecurity.

The incident has additional significance as an attack on US consulate in Benghazi on September 11, 2012 killed the US Ambassador Chris Stevens and three other Americans.

Source: Agencies