BEIRUT, Lebanon — Under the watchful eye of a military drone and three F-16 warplanes flying protective cover, 158 U.S. diplomats and 80 U.S. Marines evacuated the American embassy in Tripoli, Libya, on Saturday. Although there was no specific threat targeting the U.S. personnel, fighting between rival factions in the Libyan capital is raging amid fears the North African country is headed irreversibly toward anarchy. U.S. warships were positioned off the coast and more contingents of Marines were flown to the immediate vicinity, ready to deploy if needed to protect the evacuation convoy.

The Tripoli airport has been shut down by combat between two of the country’s most powerful militias, and most of the airplanes there have been destroyed or damaged so the evacuation had to be carried out overland: a five-hour drive to neighboring Tunisia. Under orders from Washington, the convoy pulled out of Tripoli at dawn and made it to safety by mid-day. It is unclear when or if the embassy will reopen.

Libya has been flirting with civil war for months as local gangs, ideological militias, Islamists and hopelessly dysfunctional state institutions have vied topsy-turvy for control. But this week Libya’s capital was rocked by some of the worst violence since the 2011 uprising that led to the NATO-backed ouster of strongman Muammar Gaddafi’s ouster, and with no sizeable national security force of its own, the government of Prime Minister Abdullah al-Thani has been unable to halt the descent into chaos. The U.S. isn’t alone in pulling out. Amid the rising violence, the United Nations has evacuated staff and Turkey announced Friday it was shuttering its embassy. The UK urged British citizens to leave Libya.

Since 2012 Washington has been haunted by the jihadist attacks on a U.S. diplomatic compound and a separate CIA outpost in Benghazi that killed four Americans, including Ambassador Christopher Stevens. The Obama administration has been criticized severely by Republican lawmakers for not doing enough to prevent the deaths and for failing to heed security warnings before the assault. So this time the administration was taking no chances.

A senior State Department official told The Daily Beast the decision to evacuate was taken midweek after the fighting on Monday wrecked the airport and as shelling and intense gunfire echoed around the embassy, but moving all the military assets into place, including two warships offshore, “took time.”

As the diplomats and Marines prepared their convoy in the pre-dawn twilight, smoke billowed from other buildings near the US embassy in the Abu Salim district of the capital. The evacuation plan had been drawn up months ago, but tweaked in the last hours before the withdrawal to take into account the shifting locations of militias. The progress of the caravan of SUVs and buses ferrying the embassy staff out to Tunisia was monitored in real-time in Washington.

Classified documents, databases and sensitive equipment were either destroyed or taken along to Tunisia, which suggests that despite U.S. Secretary of State John Kerry’ insistence that the closing of the embassy is only temporary, Libya could be without U.S. diplomatic representation for weeks and even months.

“Classified holdings were destroyed in accordance with procedures,” State Department spokeswoman Marie Harf told reporters in Washington DC. “Some classified equipment not normally destroyed was taken out.”

Speaking in Paris, where he was meeting with the Turkish and Qatari foreign ministers about the conflict in Gaza, Kerry blamed “freewheeling militia violence” for the suspension of American diplomatic operations in Libya, saying, “a lot of the violence is around our embassy but not on the embassy, but nevertheless it presents a very real risk to our personnel.”

Kerry said embassy staff would return as soon as the situation stabilized. State spokeswoman Harf said: “We are currently exploring options for a permanent return to Tripoli as soon as the security situation on the ground improves.” Few observes think that will be soon.

The evacuation prompted social media speculation that the embassy was under a specific threat, but a U.S. diplomat among the evacuees told The Daily Beast in an email it was the general security deterioration that prompted the withdrawal. That said, the diplomat also conceded there were worries that jihadist groups might use the militia infighting and chaos as cover for an attempted repeat of Benghazi.

The precautionary military protection for the US evacuation included two MV-22 Ospreys flying overhead with Marine reinforcements aboard. The hybrid aircraft have a vertical takeoff and landing capability. “We wanted to minimize the risks,” says the senior State Department official. He added: “The assets and capabilities we wanted were there to ensure we could deal with any threat, any eventuality.”

US Ambassador to Libya Deborah Jones, maintained a running Twitter commentary in the run-up to the evacuation, describing the perilous situation in the capital. “Our neighborhood a bit 2 close to the action,” she tweeted on Friday. She also tweeted about “heavy shelling and other exchanges” of gunfire near the embassy.

This is the third time in three years the US embassy in Tripoli has been closed completely. It was shuttered during the uprising against Gaddafi and the staff was evacuated in the wake of the 2012 Benghazi attack. But on several occasions there have been mini-evacuations with non-essential embassy staff withdrawn.

In April 2013 following a blast outside the French embassy and a botched attack on a British facility in Tripoli, some staff, including US AID workers, were temporarily evacuated. And, in fact, the embassy has not been fully staffed since the Benghazi attack.

Libya’s months-long descent into chaos has hardly figured in the policy debates in Washington – the North African country’s woes seemingly drowned out by the Ukraine crisis and the jihadist-led insurgency in Iraq. One of the biggest geo-strategic fears, though, is that jihadist groups will have another ungovernable space to exploit and use as a safe haven for training and planning.

]It isn’t clear what Washington and other alarmed Western powers can do to nudge Libya back onto a peaceful path and persuade the dizzying array of militias to give up their guns and limit their ambitions. There is no appetite in Western capitals for dispatching peacekeepers. The recent formation of an anti-Islamist alliance of some militias, including Zintan’s, under the command of a renegade general and onetime CIA asset, Khalifa Haftar, hasn’t calmed the situation, as some ordinary Libyans had hoped.

In Tripoli the violence has just worsened, with government offices closed, shops and gas stations shuttered. Trucks carrying money from the Central Bank were held up last week. The months-long wave of assassinations and abductions that have rocked Benghazi is now buffeting the capital, with government officials and political activists targeted. On Friday gunmen seized Abdel-Moaz Banoun, a well-known activist in Tripoli.

With violence heightening, the State Department has issued a general warning to Americans to stay away from Libya and advises U.S. citizens in the country to leave immediately. “Travelers should be aware that they may be targeted for kidnapping, violent attacks, or death,” the State Department said.