Both sides in Libya's civil war knew they would need to sell oil again fast once the conflict was over.
So for the most part they took care not to ruin the energy infrastructure. For example, while fierce fighting was devastating the western town of Zawiya, the large oil refinery to its north lay idle but untouched by war, its workers still able to have lunch in the canteen.
By mid-2012, less than a year after Moammar Gadhafi's demise, Libya's oil production, which was almost halted during half a year of ferocious fighting, had regained its prewar level of about 1.5 million barrels a day — years earlier than expected. Proudly, Libya's new leaders said output could soon rise to 2 million barrels or more. The oil minister, Abdelbari Arusi, promised a new hydrocarbons law and an auction of leases for unexplored territory to foreign oil companies.
Libya's oil reserves, at 47 billion barrels, already Africa's biggest, could — it was said — increase by another 10 billion.
But Libya's political chaos is, alas, spreading to the oil industry. Workers and militias now often disrupt production at energy installations, forcing the government to give them money before they will switch the valves back on.
In late May protesters shut down the Feel oil field in Libya's southwest. Tobruk, Ras Lanuf, Zueitina and other ports from which oil is exported also have been afflicted. Arusi said recently that protesters had cost his country $1 billion in lost oil revenue.
If only the government had offered decent jobs to disaffected locals and former fighters last year, things might be better today. Now the government may have to resort to force to stop the rot, which could create even worse chaos. The government is still struggling to bring an array of unruly militias to heel.
Oil people say bureaucracy is stifling recovery, as decisions get shuffled between the state-controlled National Oil Co. (NOC), the oil ministry, and Ali Zeidan, the prime minister.
The Arabian Gulf Oil Co., better known as Agoco, a part of NOC that operates in Libya's east, has for 15 months been unable to replace crucial power-generation equipment at its Sarir and Misla oil fields. Output there will probably soon drop from 380,000 barrels a day to around 300,000 barrels, costing the government $8 million a day, says one insider.
Foreign firms, unsettled by sporadic violence and an attack in January by jihadists on a gas plant in neighboring Algeria, close to its border with Libya, are not rushing to send their people back. BP, the British oil giant that was ready to begin fresh drilling when the uprising started, recently withdrew more of its foreign staff. It has not said when work will begin again.
Before an auction of oil leases, Libya needs to provide new geological information. But none of the oil field-services firms that could acquire fresh seismic data is doing so. A new oil law, meanwhile, needs to pass the General National Congress, Libya's proto-parliament.
But its speaker, Muhammad Megarief, was forced to resign last month after a law was passed to purge anyone who had ever served in a senior post in Gadhafi's regime — even though Megarief defected from his post as an ambassador more than 30 years ago.
To pacify eastern Libyans, who have tended to feel done down by the country's new rulers, who hail more from the west, the government plans to move NOC's headquarters from Tripoli, the capital, to Benghazi — a city the American and British governments advise their people to avoid because of the persistent menace of uncontrolled militias there.
So the initial optimism over oil is fading. Libya will struggle to keep output stable, let alone increase it.
This will disappoint oil traders who prize the country's high-quality crude. But it is much worse for Libyans: The IMF says oil and gas account for 70 percent of the country's GDP and 95 percent of its exports.
Despite the resumption of oil production and a sharp rise in GDP last year, Libya's economy has yet to get back to its prewar size.