Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

More than 150 Americans have been evacuated from the U.S. embassy in Tripoli, Libya, as violence in the region intensified between rival factions, the State Department said.

"The U.S. together with other countries have decided that because of the freewheeling militia violence that is taking place particularly around the embassy ... it presents a real risk to our personnel," Secretary of State John Kerry told reporters during a trip to France. Kerry clarified that the violence was taking place near the embassy “but not on the embassy,” and diplomatic activities there were suspended, not halted.

Watch: All 158 Americans have taken to Tunisian border

“We are currently exploring options for a permanent return to Tripoli as soon as the security situation on the ground improves,” Department of State Spokeswoman Marie Harf said in a statement. “We did not make this decision lightly,” Harf added.

American officials told NBC News that the 158 Americans, including 80 heavily armed U.S. Marines, left the embassy compound early Saturday in a caravan of SUV's and buses and drove west toward neighboring Tunisia.

Besides the Marines who were the embassy’s security force, the caravan was also protected overhead by two American F-16 fighter jets and unmanned drones that shadowed the group on their drive.

"Mortars were flying very near our embassy. We are really caught in the middle here and it wasn't safe to stay,” a U.S. official told NBC News.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

We have temporarily relocated all of our personnel out of Libya. http://t.co/ZnwZd2SVoT — Safira Deborah (@SafiraDeborah) July 26, 2014

At least two American warships, a guided-missile destroyer, the USS Ross and a guided-missile cruiser, the USS Vella Gulf, were nearby in the Mediterranean in case additional military protection was needed, officials told NBC News.

The operation took five hours and was conducted without incident, Pentagon Press Secretary Rear Adm. John Kirby said.

While there appeared to be no direct threat of an attack against the embassy, the rising violence in Libya recently prevented delivery of food and other vital supplies to the embassy over roads now largely controlled or threatened by rebel militant forces, the officials added.

“Political events have been building toward this confrontation for many months.”

“Our neighborhood a bit 2 close to the action,” U. S. Ambassador to Libya Deborah Jones tweeted on Friday. She also tweeted about heavy shelling and fatalities in the days leading up to the evacuation.

The fighting has been largely focused on the airport in Tripoli, where heavy violence in mid-July led to the destruction of 90 percent of the planes parked there, prompting the United Nations to withdraw its staff. Turkey on Friday also announced that it had shut its embassy.

The attack on the airport was meant as a message from Islamist militias attempting to show their political might in the country, said Ronald Bruce St John, who served on the Atlantic Council Working Group on Libya and the International Advisory Board of The Journal of Libyan Studies.

“The recent wave of violence can be seen as something of a desperation move by a variety of Islamist forces to thwart the will of the Libyan people who desire a democratic form of government, as clearly demonstrated in the three national elections held since the overthrow of the [Gadhafi] regime,” St John told NBC News.

While the Libyan people favor a democratic government, the current administration headed by Prime Minister Abdullah al-Thani lacks the military and police forces to quell the militants, St John added. “Political events have been building toward this confrontation for many months,” he added.

The move marks the second time in a little more than three years that Washington has suspended operations at its embassy in Libya. In February 2011, the embassy closed during the uprising that ultimately toppled leader Moammar Gadhafi. The embassy opened in September of that year, and Gadhafi was killed in October.

U.S. embassy in Libya in crossfire of local militias fight also at airport so embassy staff drove out 5 hrs F-16's + Ospreys overhead — Andrea Mitchell (@mitchellreports) July 26, 2014

A mission in Benghazi was permanently closed down after the attack there that killed ambassador Chris Stevens and three other Americans. The Obama administration is particularly cautious with operations in Libya following that attack, which remains a flash point for Republicans and others who say the embassy wasn’t properly secured in Benghazi and there should have been earlier evacuations because of the rising violence in the months prior to the attack.

The embassy In Tripoli has been operating with reduced staff since September 2012, but has remained open even during heightened violence.

The Department of State simultaneously warned U.S. citizens from travelling to Libya and urged Americans in the country to leave immediately. “Many military-grade weapons remain in the hands of private individuals, including antiaircraft weapons that may be used against civilian aviation,” the travel warning said.

Various groups in the region have called for attacks on U.S. officials, U.S. citizens and those who associate with them, the warning continued. “Travelers should be aware that they may be targeted for kidnapping, violent attacks, or death.”

The Associated Press contributed to this report.