WASHINGTON--The Obama administration said on Saturday it has evacuated its personnel from Tripoli as fighting between warring militias in Libya has reached the capital.

Officials said the evacuation was conducted over land, with the State Department driving personnel from the American embassy in Tripoli to Tunisia. U.S. military units provided security, flying fighter jets, surveillance planes and positioning response forces in V-22 tilt rotor aircraft in the area to respond to potential threats, officials said. The evacuation was completed without incident, officials said.

The State Department said the embassy move was temporary.

"Due to the continuing violence resulting from clashes between Libyan militias in the immediate vicinity of the U.S. Embassy in Tripoli, we have temporarily relocated all of our personnel out of Libya," Marie Harf, a State department spokeswoman, said.

The Obama administration was accused of not moving quickly enough to evacuate its diplomats in Libya ahead of the Sept. 11, 2012 attack on its facilities in Benghazi that killed the Ambassador Christopher Stevens and three others.

In Paris, Secretary of State John Kerry stressed that U.S. embassy operations in Tripoli had only been suspended due to the "freewheeling militia violence" in the Libyan capital. " We will return the moment the security situation permits us to do so," Mr. Kerry said before a meeting with foreign ministers from Turkey and Qatar.

Most of the U.S. embassy personnel will continue working on Libya issues from American diplomatic missions in Tunisia, Mr. Kerry said. The U.S. will also continue communicating to Libya's leadership through the British embassy in Tripoli and other foreign embassies.

"We call on all Libyans to engage in the political process and to come together to avoid the violence," Mr. Kerry said.

The evacuation on Saturday took about five hours, said Rear Adm. John Kirby, the Pentagon press secretary.

Adm. Kirby said the Marine Corps security guards who provide security at the embassy were also relocated. He said the evacuation was done at the request of the embassy.

Ms. Harf said that embassy personnel would return to Libya when the security situation improves. U.S. diplomatic staff will operate out of Washington and other embassies in the region until the State Department determines they can return to the embassy in Tripoli.

In recent months, the Libyan government has struggled to clamp down on violence from militias and keep control of the country.

For nearly two weeks, an Islamist militia from the coastal city of Misrata has been fighting a more secular militia hailing from the mountain town of Zintan for the control of an airport 30 kilometers south of the capital.

The fighting has killed dozens and now has moved into Tripoli itself, forcing evacuations of expatriates working for foreign oil firms as well as a large part of the United Nations staff. With the capital all but paralyzed, residents on Saturday were reporting intense rocket fire, along with power and water cuts and fuel shortages.

Libya's interim prime minister, Abdullah al-Thani, has ruled out a direct foreign intervention but has said it is seeking some other forms of international assistance.

Libya's justice minister, Salah Elmarghani, said he had been in contact with the International Criminal Court to start looking into possible war crimes being committed. "We warned that war crimes are being committed in Libya," he said.

In a statement Friday, the prosecutor of the International Criminal Court, Fatou Bensouda, said he was troubled by "reports of alleged attacks carried out against the civilian population and civilian objects in Tripoli" and Benghazi.

Fighting between a renegade general and Islamists also has been going on for weeks in the Eastern city of Benghazi.

Write to Julian E. Barnes at julian.barnes@wsj.com, BenoƮt Faucon at benoit.faucon@wsj.com and Jay Solomon at jay.solomon@wsj.com

Subscribe to WSJ: http://online.wsj.com?mod=djnwires