These four military personnel were operating in an area near the coastal city of Sabratha in northwestern Libya as part of security preparedness efforts when they were taken into custody, State Department spokeswoman Jen Psaki said in a statement. Sabathra, about 40 miles west of Tripoli, is a popular tourist area with its ancient Roman ruins.
No one was injured. The military personnel were taken to the U.S. Embassy after their release, a Defense Department official said. The official was not authorized to discuss the incident by name and requested anonymity.
The four were supporting U.S. Marine security forces protecting the American Embassy, the official said. They were likely U.S. special operations forces, which have been deployed to Libya.
An altercation apparently took place at the checkpoint, the Defense Department official said. Reports of gunfire could not be confirmed.
After they were detained at the checkpoint, the Americans were transferred to the Ministry of the Interior and held for a few hours, the official said. Psaki said U.S. officials were still trying to confirm details of the incident.
"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."
The U.S. Embassy in Tripoli includes a security detail. The embassy's personnel are restricted in their movements in Libya.
Libya has been marked by unrest since the ouster in 2011 of longtime dictator Moammar Gadhafi. Armed groups that fought Gadhafi's army turned themselves into militias that exploited the weakness of the weak central government in Tripoli and operate independently of the police and the military.
In September 2012, terrorists attacked the U.S. diplomatic mission at Benghazi, Libya, killing U.S. Ambassador Chris Stevens and three other Americans.
President Barack Obama, who was vacationing in Hawaii, was updated about the incident by staff from the White House's National Security Council, officials said.