Story highlights The four people were held for several hours before being released, an official says

The Americans had driven away from checkpoint, a Libyan official says

The four were augmenting security at the U.S. Embassy in Tripoli, a U.S. official said

They were believed detained by the Interior Ministry, an official said

The Libyan government on Saturday defended its brief detention of four U.S. military personnel in western Libya, saying they were taken into custody after two vehicles in an American convoy sped off from a checkpoint.

When the three-vehicle convoy was stopped Friday near al-Aijalat, officials discovered that one of the vehicles carried two Americans who were armed, said Abdulfattah Saleh, director of national security in the department of Sabratha, about 50 miles west of Tripoli.

As the two were being questioned, the other cars in the convoy drove off, Saleh said. One of the vehicles that drove off caused an accident, he said.

The two who were being questioned as well as two occupants of the vehicle involved in the accident were detained and handed over to the Interior Ministry, Saleh said.

The four were detained for hours Friday before being released, U.S. officials said.

Earlier Saturday, State Department spokeswoman Jen Psaki said U.S. officials were "still trying to ascertain the facts of the incident."

The four were in Libya "augmenting security at the U.S. Embassy in Tripoli," a State Department official told CNN late Friday on condition of anonymity.

The detentions followed the U.S. announcement last month that it was stepping up military support for Libya's fledgling security forces, which have been overwhelmed by militia violence and unrest since the overthrow of dictator Moammar Gadhafi in 2011.

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, where increasing violence has included assassinations.

On September 11, 2012, U.S. Ambassador Christopher Stevens and three other Americans were killed 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.

The detention of the four personnel followed reports of a U.S. military operation in October that saw members of the Army's elite Delta Force launch a raid in Tripoli that captured Abu Anas al Libi, an alleged al Qaeda operative wanted for his role in the deadly 1998 bombings of two U.S. embassies in Africa.

Libya's interim government called his capture a kidnapping and demanded an explanation from Washington.

"We value our relationship with the new Libya," Psaki said. "We have a strategic partnership based on shared interests and our strong support for Libya's historic democratic transition."