The overthrow of Libyan strongman Moammar Kadafi five years ago by NATO-backed rebels left a political vacuum in the oil-rich North African nation, with rival governments and armed militias battling ever since for control.
A new Obama administration plan to funnel international support to an untested government in Tripoli is intended to give Libya -- and U.S. policy -- another chance.
It also involves a major dose of nation building, an open-ended policy that President Obama long has sought to avoid.
The challenge is immense. The United States and its allies will have to vet the Libyan militias and security forces amid the ongoing conflict, while shoring up a fragile government that barely exists on the ground.
Secretary of State John F. Kerry, who announced the plan Monday in Vienna, acknowledged the long road to restoring security and economic stability in Libya.
"It means helping to ensure that such key institutions as the central bank and the national oil company receive the oversight and the direction they need," he said.
"It means doing more to address urgent humanitarian requirements," he added. "It means laying the groundwork for sustained support in the fields of security, finance, counter-terrorism and overall governance."
The Obama administration and its allies have little choice, he argued.
"Libya has an opportunity to be a safe country for its citizens, or it could be a safe haven for terrorists, trapped in division and chaos, and beset by personal, international and tribal rivalries," he warned.
The U.N. has awarded legitimacy to the new Government of National Accord, headed by Prime Minister Fayez Sarraj.
But Sarraj has yet to make peace with the two rival governments that control substantial parts of Libya.
The most powerful force since 2014 has been the General National Congress, which includes numerous militias. It opposes the harsh ideology of Islamic State, but also opposes Sarraj's efforts to unite Libya under his authority.
Another powerful group, the self-declared National Salvation Government, is based in Tobruk and includes members of the Libyan House of Representatives.
Gen. Khalifa Haftar, who controls that faction, has, through proxies, condemned the international plan as meddling in Libyan affairs.
Adding to the challenge, Egypt and Russia have indicated that they will not support arming new government forces until the parliament in Tobruk is brought back to Tripoli as the national legislative body.
“Divisions within the international community are likely to postpone the lifting of the arms embargo,” Riccardo Fabiani, senior analyst for the Middle East and North Africa at the Eurasia Group, said Tuesday.
With the new government on such shaky ground, one danger is that any weapons could quickly fall into the wrong hands -- the reason the U.N. imposed the arms embargo in the first place.
In a recent article in the Atlantic, Obama said that watching Libya descend into political chaos after a North Atlantic Treaty Organization air war helped topple Kadafi in 2011 was one of his main foreign policy regrets.
“We actually executed this plan as well as I could have expected,” he said. “We got a U.N. mandate, we built a coalition.... We averted large-scale civilian casualties, we prevented what almost surely would have been a prolonged and bloody civil conflict.
“And despite all that, Libya is a mess.”
Whether the latest White House strategy will bring stability to Libya, or block Islamic State's growth there, is far from clear.
“Arming and training rebels … depends on do you find the right faction, how stable are they and can you carry out training in ways that are effective?,” said Anthony Cordesman, a security expert at the nonpartisan Center for Strategic and International Studies in Washington.
But the "risks of not acting are probably greater than doing the best you can,” he said, as treacherous as that path might be.
“It’s the right thing to do,” agreed Sen. John McCain (R-Ariz.), chairman of the Senate Armed Services Committee and a harsh critic of Obama administration policy in Libya.
"None of this would have been necessary if we hadn’t just walked away from Libya after Kadafi had been eliminated, which we did," he added. "We completely walked away from Libya. And the results were predictable.”
Adam B. Schiff (D-Burbank), top Democrat on the House Intelligence committee, noted the “enormously difficult challenge” of training and equipping Libyan forces given that the Sarraj government is still in its infancy.
But the threat from Islamic State "is just too proximate to delay any further," he said. If the group is allowed to expand, "we've seen in Syria and Iraq how hard it is to uproot."
Based in Surt on the northern coast, the militants are hemmed in by rival militias. But they have attracted thousands of recruits from elsewhere in Africa, raising fears that they will use Libya to launch terrorist attacks in Europe and Africa.
Except for Kurdish militias, who have proved formidable fighters against Islamic State in Syria and Iraq, the U.S. military has not found great success in backing local military forces in the post Sept. 11 world.
U.S. advisors spent nearly a decade training and equipping the Iraqi army before the U.S. withdrawal in 2011, for example.
But only about half Iraq's 50 brigades stood and fought Islamic State when their convoys roared in from Syria in 2014. The rest fled or were found to be tainted by sectarianism and corruption.
In Afghanistan, U.S. advisors have worked with Afghan security forces for 15 years, which has cost $4.1 billion in annual U.S. military aid and training.
Yet in September, Taliban insurgents captured Kunduz, the first major city they controlled since the U.S.-led invasion in 2001. Afghan forces, backed by U.S. special operations and gunships, later recaptured the northern city.
In Syria, a Pentagon plan to provide arms, equipment and six weeks of training to pro-Western rebels to fight Islamic State last year proved an embarrassing failure.
After the training, most of the recruits quickly surrendered their U.S.-issued weapons, ammunition and trucks to an Al Qaeda affiliate in northern Syria. The program was closed, and the Pentagon now funnels weapons to other Syrian groups.
Times staff writer Michael A. Memoli contributed to this report.
For more on international affairs, follow @TracyKWilkinson on Twitter