By Peter Apps, Political Risk Correspondent
LONDON (Reuters) - With Muammar Gaddafi's 42-year rule effectively over, Libya's new leaders and their foreign allies face the daunting task of restoring order, beginning reconstruction and avoiding collapse into conflict and chaos.
Giving the provisional government access to Libya's frozen era funds and restoring oil exports will be key to what the West hopes will be a largely self-financing reconstruction, but there are a host of other immediate challenges.
The rapid rebel advance on Tripoli, supported by NATO airstrikes -- and perhaps advisers on the ground -- looks to have taken many by surprise. Now the rebel National Transitional Council (NTC), foreign governments, oil firms, aid groups and a host of other players must frantically race to catch up.
"What you almost always find in these cases is that the postwar planning hasn't kept pace with the planning for the conflict itself," said David Hartwell, Middle East analyst at IHS Jane's. "There's going to be a lot to do."
Whilst uprisings in Tunisia and Egypt removed unpopular national leaders but left most of the wider government and military bureaucracy intact -- to the irritation of some protesters -- Libya's revolution is more radical.
It is unclear how many of Gaddafi's government and security structures will endure. His rule was idiosyncratic and personal, designed to avoid the creation of power centers that could challenge him. Few, if any, independent institutions exist.
With memories of Iraq fresh in the minds of many postwar planners, restoring security is seen the most urgent priority. But neither Libyans nor intervening states have any appetite for deploying foreign troops, beyond perhaps a handful from Arab countries.
The Benghazi-based NTC has worked with Western advisers for months on planning the transition, but many questions remain.
Given the problems faced by troop-heavy Western involvements elsewhere, some see advantages in letting the Libyans find their own path. But that will involve striking a difficult balance that eluded Western powers after other recent interventions.
"You can't get rid of all the old structures and you have to let new systems and leadership emerge," said Graeme Lamb, a former British general and director of special forces who advised U.S. commanders in Iraq and Afghanistan.
"The fact that Benghazi and other cities under rebel control have not become looters' paradises is worth remembering ... What's really important in this case is that they feel they have done it for themselves."
The rebels say they have been training thousands of security personnel in the eastern city of Benghazi ready to move to Tripoli for the complex task of restoring order, but analysts question the readiness or even the existence of these forces.
NATO could offer to help transport them to Western Libya by sea or air, but whether they would be welcomed is unknown. The rebels from western Libya who took Tripoli have long criticized their eastern counterparts for their perceived slowness to advance. Their loyalty to the NTC is in doubt.
"Demobilization of rebel armed groups will be important, starting with, if possible, the collection of any weapons distributed to rebel groups by NATO countries," said Nikolas Gvosdev, professor of national security studies at the U.S. Naval War College. "Leaving Libya awash with arms will not help stability."
The West must shift gears from the military effort to broad support for Libyan efforts toward stability and reconstruction. This could involve an international donor conference under U.N. auspices and close liaison with regional allies.
"All of this will benefit from Western expertise but at Libyan asking and in a regionally-dominated mission," said Daniel Korski, a senior fellow at the European Council on Foreign Relations. "The West now needs to help rally the international community, much as it did in Iraq and Afghanistan."
OIL, ECONOMY, INFRASTRUCTURE, TRANSPARENCY
Even if no foreign troops were deployed, Korski said some form of unarmed monitoring mission -- perhaps staffed mostly by members of the Arab League or African Union -- might be useful.
Infrastructure will also need repair -- and not just to fix damage from air strikes. While Gaddafi spent millions on roads, hotels and other projects, much of Libya remains undeveloped.
Easterners in particular feel deprived. Redressing their grievances without worsening east-west tension will be delicate.
Restoring oil exports swiftly would help fund reconstruction and getting the wider economy moving -- crucial if the rebel leadership is to retain legitimacy and avoid new unrest.
The NTC is keen to project an image of continuity, with its official in charge of reconstruction telling Reuters on Wednesday the new government would honor all Gaddafi-era oil contracts, including those with Chinese and Russian companies.
"The contracts in the oil fields are absolutely sacrosanct," Ahmed Jehani told Reuters Insider TV late on Tuesday.
"Right now we are focused like a laser on stabilization, how you stabilize security, the services to your people, humanitarian (support)," he said. "You get the governance right, you get the economy right, all of these things you need to do and focus on them, then you move into rehabilitation."
He estimated it would take at least nine months to restore oil and other industrial infrastructure to normal.
Some observers have suggested firms from nations that helped the rebels militarily might benefit now they have taken charge, while those from Russia and China -- much more lukewarm on intervention -- might suffer. But Western nations too also face questions over their deals with the previous rulers.
Anti-corruption group Global Witness said Gaddafi-era contracts should be honored for now, but advocated a moratorium on new deals until the advent of elections and a constitution and suggested pre-existing deals should at least be re-examined.
Failure to build a transparent system giving Libyans confidence that revenue was being used for the good of the whole country may be crucial to avoiding future conflict, they said.
"One of the key causes of the Arab spring has been massive public dissatisfaction with the abuse of public finances and revenues and that will need to be addressed," said Brendan O'Donnell, a campaigner at London-based Global Witness.
"Western states need to take a hard look at themselves and some of their practices as they have been heavily complicit in this."
(Editing by Alistair Lyon)