Enormous oil wealth lies thousands of feet below Libya, but whether it will be claimed -- and by whom -- now that Moammar Gadhafi is gone is very much an open question.
Drilling and shipping equipment has been damaged in the Libyan civil war, land mines must be cleared around oil fields, and a legal framework for how oil money is collected and distributed must still be worked out.
Whatever government is formed could open vast regions of Libya for drilling at reasonable terms -- or it could demand that foreign oil companies pay exorbitant royalties or require them to build infrastructure in exchange for access to oil.
Libya sits on the biggest reserves of oil in Africa. Those resources could help Libya recover from Gadhafi's decades-long corruption and the civil war. Or the oil could be kept out of reach by political chaos, crumbling infrastructure or violence.
"It's extraordinary how the Gadhafi regime squandered so much oil wealth and left [Libya] a deprived country in terms of infrastructure," says Daniel Yergin, chairman of energy research firm IHS CERA and author of "The Prize: The Epic Quest for Oil, Money, and Power," a Pulitzer Prize-winning history of the oil industry. "The country will need oil revenues to rebuild and recover."
The oil industry had already begun to recover in recent months, especially in parts of the country where fighting had long since stopped. Libya is producing about a quarter of the 1.6 million barrels per day of oil it pumped out before the war.
Gadhafi's death reduces the threat of further fighting in other parts of the country, especially the west and south, where the country's most important oil fields are. In the best outcome, the national oil company and international companies will soon be able to return to those fields, repair equipment and get oil flowing again.
Analysts say it will take about a year for the country to return to full oil production, but many uncertainties remain.
The country has the potential to someday produce much more oil than it has in recent years, but the oil industry could languish if Libya's dozens of tribes can't form a representative government and the country falls into chaos.
The first and most important step is to establish security, experts say. International oil companies with a presence there won't bring in engineers to assess damage to oil fields and pipelines until they are reasonably sure their workers will be safe.
Gadhafi loyalists are thought to have planted land mines around critical oil infrastructure. Thousands of shoulder-fired missile systems have disappeared from Libyan weapons depots and could be in the hands of Gadhafi loyalists or insurgents.
"If you want to cripple the state, you attack its biggest source of revenue," says Helima Croft, an analyst for Barclays.
Next, the country must set up a system for oil companies to negotiate contracts for finding, retrieving and selling oil. At least in the interim, it appears that a government oil minister will set policy, such as how much oil companies must pay to extract Libyan oil, and the head of the national oil company will oversee operations.
But the details will probably remain in flux until an interim government can be established. Until then, oil companies can't be sure that their existing contracts in Libya will remain in effect, although the head of the national oil company has said contracts will be honored at least for a while. It would be up to an elected government to determine whether the contracts would be revised.
What's most important, analysts say, is that oil companies feel assured that whatever terms are set will not change in the future. Otherwise, they will never agree to spend tens of billions of dollars to repair fields and infrastructure and restore production. Some of the nation's oil fields, pipelines, refineries and shipping terminals are in relatively good repair, but others are badly damaged.
In general, though, analysts say infrastructure in Libya is in better shape than once feared.
"What we haven't seen is oil fields blazing," says Jon Marks, an Africa and Middle East expert with London-based consulting firm Cross-border Information.
Major international oil companies that operated in the country before the civil war, such as Italy's Eni and Spain's Repsol, are beginning to assess the situation and restore production in the oil fields offshore and in Libya's east, long held by anti-Gadhafi forces.
But international oil companies have yet to assess oil fields in the south and west, which produce most of the nation's oil. U.S. companies that were active in Libya before the war, including Hess Corp. and Marathon Oil Corp., have not returned workers to the country.
There are other issues. Many of the country's most experienced and senior oil engineers are seen by workers as Gadhafi loyalists. At one field, workers are refusing to work until these top engineers are removed.