Washington (CNN) -- The four U.S. military personnel being held in Libyan government custody have been released, a U.S. Defense Department official said late Friday.
The four were believed to be held by the ministry of the interior, the official, with knowledge of the situation, said on condition of anonymity.
It was not immediately known why the American personnel were in Libyan custody. "We are seeking to further ascertain the facts and ensure their release," the official said.
The four were in Libya "augmenting security at the U.S. Embassy in Tripoli," the official said.
A second person -- a senior U.S. official -- also told CNN that the four military personnel had been detained. That official also spoke on condition of anonymity.
The news of the detentions followed an announcement by the United States last month that it was stepping up military support for Libya's fledgling security forces, who have been overwhelmed by militia violence and unrest since the overthrow of dictator Moammar Gadhafi.
Popular sentiment against the various militias has been mounting for months in Tripoli and other parts of the country, including the eastern city of Benghazi, which has been gripped by increasing violence, including political assassinations.
The chaos in Libya hit home for Americans after U.S. Ambassador Chris Stevens and three other Americans were killed on September 11, 2012, in an attack on the U.S. diplomatic mission in Benghazi.
The United States has offered a reward of up to $10 million for information leading to the arrest of anyone involved in that attack. While U.S. authorities have filed charges in the case, no one has been arrested.
A NATO air campaign helped overthrow Gadhafi two years ago, but ever since there has been widespread unrest and poor security.
The detention of the four personnel also followed reports of a U.S. military operation in October that saw members of the elite Army Delta Force launch a raid in Tripoli to capture Abu Anas al Libi, an al Qaeda operative wanted for his alleged role in the deadly 1998 bombings of two U.S. embassies in Africa.
Libya's interim government called the capture a kidnapping and demanded an explanation from Washington about the raid.
Barbara Starr reported from Washington, and Chelsea J. Carter wrote from Atlanta; CNN's Elise Labott contributed to this report.