Nigeria has long been Africa's sleeping oil giant. Its industry slumbers under the weight of stalled reform, unprecedented levels of theft and corruption and both northern and southern insurgencies. Now there is a new, external problem to awaken it: the oil minister Diezani Alison-Madueke warned that African countries could lose a quarter of their oil revenues because of the surge of United States production.

The West African heavyweight is the world's sixth-largest oil exporter and Africa's largest producer. It ranks 10th in world oil reserves and ninth in gas. It is also a continental power - twice as populous as any other African country, and in the top three economies.

Nigeria's oil sector has a lot in its favour - high-quality light crude oil, straightforward geology, promising giant deepwater fields, and lots of cheap gas within easy reach of Europe. It attracts a diverse range of companies from Shell and ExxonMobil to buccaneering wildcatters and emerging local players, such as that owned by Aliko Dangote, Africa's richest man. And it has an exceptionally large and talented class of engineers and geologists, not to mention a vocal if turbulent democracy.

A steady upswing in the early 2000s, as Nigeria emerged from the kleptocratic dictatorship of Sani Abacha, inspired hope of unleashing the giant. But violence surged in the Niger Delta's south-east, locus of the country's oil, fuelled by local resentment over a lack of economic development and environmental damage, extortion, ethnic tensions, and clumsy and brutal government countermeasures.

Production fell by a quarter between 2005 and 2009, as attacks hit oil infrastructure and workers were kidnapped. With perhaps 400,000 barrels per day off the market, the fighting was a key factor in 2008's record world oil prices.

President Goodluck Jonathan, himself a Delta native, introduced an amnesty for militants, including payments and retraining. Nigerian production has recovered - but at the cost of institutionalised protection money.

The practice of "bunkering" - illegal export of crude oil - always prevalent, has become epidemic, costing the country about US$7 billion per year. Smoke rises over the Delta from hundreds of unofficial oil refineries, and leaks and spills contaminate the creeks where local villagers fish. The major oil companies are not blameless of pollution, but much of the ecological disaster is beyond their control.

The Nigerian armed forces sometimes destroy illegal refineries or detain bunkering vessels - but the military, government and oil companies are riddled with accomplices.

President Jonathan has been trying to reform the sector. The Petroleum Investment Bill (PIB) is a kind of Nigerian version of the interminable court case in Charles Dickens's Bleak House. In the works for 15 years, it has been wending its way between parliament and government for the past five.

It is meant to overhaul regulation and taxation, create a true national oil company beyond the opaque Nigeria National Petroleum Corporation, establish a sovereign wealth fund, finally unlock Nigeria's gas wealth and rebalance revenue-sharing with the non-oil producing regions.

Now the Boko Haram insurgency in Nigeria's north has thrown up yet another hurdle to the PIB. Even an unlucky former oil minister, aged 87, was kidnapped in the north this month.

President Jonathan declared a state of emergency in three affected states, but angry northern governors believe the bill offers too much to his south-eastern base and will probably block its passage this year.

Nigeria's light crude competes directly with US shale oil - its share of the American market has fallen from 11 per cent in 2011 to just 5 per cent last year. This means fiscal rectitude, attracting foreign investment, fixing fuel subsidies, restarting exploration and solving the country's electricity crisis are more important than ever.

Nigerians have seen $400bn of oil money go missing since 1960, but the zero-sum struggle to carve up the golden goose continues.

Robin Mills is the head of consulting at Manaar Energy, and author of The Myth of the Oil Crisis and Capturing Carbon