Smoke rises from an oil facility in northern Libya's Ras Lanouf region in January after it was set ablaze following fresh attacks by the Islamic State. A militia commander says he soon will reopen it. (STRINGER/AFP/Getty Images)

The rapid deterioration of Libya’s oil-dependent economy is threatening the objectives of the country’s new Western-backed government and budding efforts to confront the Islamic State in North Africa, political and security analysts say.

Within hours of arriving in Tripoli two weeks ago, the government made controlling the nation’s oil a priority. It persuaded a powerful militia to hand over three oil terminals, and the national oil company gave its support.

But the road to securing Africa’s largest reserves is riddled with even greater obstacles, and bringing the battered industry back to its full potential promises to be a colossal mission. With global crude prices in a slump, there is a sense of urgency for the unity government to boost oil production and alter Libya’s trajectory.

“Libya is on the verge of economic and financial collapse,” said Claudia Gazzini, senior Libya analyst for the International Crisis Group.

Instability has sharply reduced production levels as armed factions have taken over oil and gas regions. If the government fails to exert control, the contest for energy resources could deepen political fissures and trigger more violence, preventing the unified front that Washington and its allies seek against the Islamic State, analysts say.

Resurrecting Libya’s oil production is crucial to preventing economic ruin, which could force the country to become heavily dependent on Western aid and propel more Libyans to flee to Europe, adding to the refugee crisis there. It’s also vital for the government’s survival.

“As far as the economy is not solved, as far as the economic power has not been shared, you will not be able to find a political solution,” said Merin Abbass, regional director of Friedrich Ebert Stiftung, a German political foundation working on peace-building in Libya. “Who has the access to the oil in Libya has also the political power.”

The challenges include regional and ethnic power struggles, and independent efforts to sell or smuggle oil. Two other ­self-declared governments — one in the capital, Tripoli, the other in the eastern city of Tobruk — are also competing for influence. Many militia members, whose loyalties are fickle, still receive government salaries that hinge on oil production. Key oil fields and pipelines are closed as a result of insecurity, militia rivalries and labor disputes. And after years of civil war, oil infrastructure is in disrepair, analysts say.

Moreover, Islamist militant groups are increasingly targeting the industry in North Africa. They view oil production as a theft of natural resources perpetrated by Western oil companies. Attacking facilities is a high-profile way of undermining national economies and generating propaganda to gain recruits.

Last month, al-Qaeda’s North Africa branch asserted responsibility for a rocket attack on an Algerian gas plant operated by European oil companies, and it vowed more assaults on Western oil firms. Last August, the Islamic State affiliate in Egypt kidnapped and beheaded a Croatian employee of a French oil and gas firm.

In Libya, the Islamic State has attacked several petroleum facilities, including storage tanks that were set on fire in January at the Ras Lanuf and As Seder terminals, which are among the country’s largest.

“The Islamic State has resorted to trying to destroy the oil sector in order to prevent any of its antagonists from benefiting from the hydrocarbon sector revenue,” said Geoff Porter, the head of North Africa Risk Consulting, a political and security risk firm. “Attacking the hydrocarbon sector fits the jihadi narrative.”

The Libyan economy has long relied almost entirely on oil and gas extraction, which accounts for 95 percent of its export earnings and 99 percent of government income, according to U.N. statistics.

Five years ago, before the violent revolution that ousted dictator Moammar Gaddafi, Libya was producing 1.6 million barrels of oil a day. Although there was significant mismanagement and corruption, the revenue paid the massive government workforce, strengthened Libya’s currency and brought economic growth. Even as the regime committed abuses, it improved housing for average Libyans, provided free public education and medical care, and built good roads.

After Gaddafi was killed, oil became an attractive prize. As Libya plunged into civil war, powerful warlords battled for control, especially in Libya’s “oil crescent” along the Mediterranean. The absence of a cohesive security system for oil and gas infrastructure made it a target of the Islamic State.

Today, Libya’s oil production stands at roughly 360,000 barrels a day — a 78 percent drop from five years ago.

“On the ground, loopholes are being exploited by armed actors who have been seeking to generate financial and political gain from the control of oil fields, pipelines and export terminals, fueling local conflicts,” U.N. investigators wrote in a report released last month.

It is unclear whether the unity government, which is sponsored by the United Nations, has the clout to bring Libya’s rival factions and militias — and by extension, the oil — under its control. Its leadership, known as the Presidential Council, has not gained the approval of either of the two rival governments. Instead, it has sought legitimacy through pledges of support from the various armed factions.

Ibrahim Jathran, a commander of a militia that controls several oil facilities, recently announced that his group would back the unity government and reopen oil terminals in Ras Lanuf, As Seder and Zuetina. Ras Lanuf and As Seder, which shut down in December 2014, alone have the capability to export 550,000 barrels a day.

The announcement raised hopes that Libya could increase its exports again. But a new dispute has thrown the oil terminal openings in doubt. A faction broke away from Jathran’s group and declared its allegiance to a powerful anti-Islamist general, Khalifa Haftar, who commands the forces of the rival Tobruk government and also seeks to control oil ports.

The eastern government, which has created a rival National Oil Corporation to sell oil, has not accepted the unity government, with some top officials publicly threatening to secede from the west.

Even if the unity government regains control of the oil, restarting Libya’s production could be months away, and may never reach the heights of five years ago, analysts said.

“Many of the eastern oil fields are either offline due to damage or under control of groups more loyal to Haftar than to the Presidential Council, or are hostile to Jathran,” Gazzini said. “So switching on the oil production button will not be so easy.”

Read more:

Another Western intervention in Libya looms

In Libya, the Islamic State’s black banner rises by the Mediterranean

Does the U.S. military think Libyans will fight the Islamic State together? Not necessarily.

U.S. strike on Libya camp escalates campaign against Islamic State