(CNN) -- Tribal rivalries, an east-west divide, a rebel leadership lacking coherence, a shattered economy and the absence of a "civil society" -- these are just a few of the challenges that a post-Gadhafi Libya will face.
The rebel National Transitional Council is aware of the perils ahead and has produced a blueprint for the immediate aftermath of Gadhafi's downfall and for a political process leading to democratic elections.
Haunted by the lack of planning in Iraq after the overthrow of Saddam Hussein, the international community -- in the shape of the Libyan Contact Group -- has urged the NTC to pursue reconciliation.
In a statement Sunday night, President Barack Obama called on the NTC to pursue "a transition to democracy that is just and inclusive for all of the people of Libya."
But that is no simple formula in a society riven by deep-seated rivalries and with no experience of democracy.
In 42 years as Libyan leader, Moammar Gadhafi purged Libyan society of any alternative voice or real discourse.
His Revolutionary Committees were ubiquitous, silencing dissent and enforcing the eccentric orthodoxy of the "Brother Leader's" teachings.
In such a warped society, there has been little space for the emergence of a professional, qualified middle-class, and none for trade unions, opposition groups or other symbols of civil society.
The only organized group not tied to the regime was the Muslim Brotherhood, driven underground by Gadhafi.
As in Iraq in 2003 or Syria now, there is no recognized opposition figure or group that transcends tribal, regional and sectarian rifts.
Gadhafi survived as long as he did, according to Libyan scholar Mansour O. El-Kikhia, by breaking up the power bases of Libya's largest and most influential tribes.
Lands and influence were redistributed to more "dependable" tribes such as the Warfalla, Qadhadfa and Megarha.
Places like Gadhafi's hometown -- Sirte -- received more resources than those regarded as less loyal. But tribal loyalties have survived and perhaps become more important in the absence of other political institutions.
Eastern Libya -- where the rebellion began and is still based -- has long been at odds with the west, Gadhafi's power base.
The pattern of the past six months' conflict suggests that geographical divide persists. Tribes in the west may not take kindly to the sudden dominance of a movement that began in the east. The rebel leadership in Benghazi has tried to co-ordinate with the rebellion in the west -- which began in the Nafusa Mountains and in some ways has been more effective on the battlefield -- but has not directed or controlled it.
Libya is a vast country -- 1.75 million square kilometers - with many "under-governed" spaces, especially in the immense Sahara.
In neighboring states such as Chad, Algeria and Niger, these are the spaces claimed by revolts and more recently by Islamist groups professing allegiance to al Qaeda.
Gadhafi had his own problems with Islamic extremism -- the Libyan Islamic Fighting Group was one of the most effective groups sympathetic to al Qaeda before its leaders turned against jihad in return for a mass release from Libyan jails.
Towns in eastern Libya became well-known for supplying fighters to the insurgency in Iraq, though the rebel leadership insists Gadhafi has exaggerated the threat of Islamist extremism for his own ends.
Then there is the resurgent Berber identity in the western mountains. Gadhafi persecuted the Berbers, a non-Arab minority -- even accusing them of being agents of the CIA.
But in the months since his forces have lost control of the Nafusa Mountains, the Berbers have re-established their language (Tamazight), their culture and even their flag. They are determined not to be subjugated again.
The Berber Institute for Civil Society issued a statement this weekend setting out the community's demands: "Tamazight should be recognised in the Constitution in all its dimensions ... This is a prerequisite of the Amazigh movement."
Libya's oil wealth has been a curse as well as a blessing. It has allowed lavish spending on education (with thousands of students sent to universities overseas) and infrastructure, and government subsidies have made staples affordable for millions.
But there's been virtually no diversification of the economy; about 95% of the Libyan state's revenues derive from hydrocarbons. Unemployment probably exceeds 30% and half the population is under the age of 15. The civil service is thought to employ about one in five Libyans.
Gadhafi built up a byzantine bureaucracy, but not one known for its efficiency. The adage among Libyans is "Inshallah, bokra, moumken," which means "With the will of God, tomorrow, maybe."
Nor is there much entrepreneurial spirit. Much of the hard work -- building railroads, servicing oil installations -- has been done by economic migrants and contract workers -- and hundreds of thousands of them fled when the fighting began.
But Libya has advantages.
About 80% of its people are literate; electricity is connected to almost the whole country.
Economists say there are long-term opportunities -- Libyan oil is plentiful and low in sulphur -- if new industries can be built and a work ethic encouraged. Much also depends on whether opposition figures like Ali Tarhouni, who taught at the University of Washington State and holds the economic and oil portfolio, are given authority.
But the immediate priorities, according to western diplomats, center on basic services: electricity, food, water and above all security -- priorities that were ignored in Iraq. British Foreign Secretary William Hague has urged the NTC to ensure that technocrats in the Libyan government are not purged.
Libyan opposition officials envisage several thousand Arab troops -- possibly from the United Arab Emirates and Qatar -- being drafted into the capital to help stabilize what could be a chaotic situation.
Saddam Hussein's fall was followed by an orgy of looting in Baghdad. How far the remnants of Gadhafi's army and police can be integrated into new security forces is a huge open question.
But a template drawn up by the NTC's envoy in the Emirates, Aref Ali Nayed, includes detailed plans for keeping police units in uniform. Journalist Derek Flood of the Jamestown Foundation, who has recently been in the western mountains, told CNN that he witnessed police training programs under way.
The rebels seem to be aware that a new security force imposed from the east would be a recipe for trouble. Much will depend on whether Gadhafi loyalists begin a campaign of sabotage after he has gone, much as Saddam Hussein's Baathists did.
There are also plans for an airlift of humanitarian supplies and the rapid rehabilitation of the oil infrastructure, though industry experts say it will be some time before pre-war exports of 1.6 million barrels a day can be attained.
Plans are one thing, but without an inclusive transition and transparency they will be quickly overwhelmed.
For the more unscrupulous, there will be temptations to divert oil revenues to private accounts.
The anti-corruption group Transparency International rates Libya 146th in its corruption perception index, close to the bottom of the league.
The NTC lacks cohesion -- a hastily devised group of former regime figures, intellectuals, nationalists, secularists and Islamists. It has also shown disunity to a murderous degree -- witness the murky circumstances of the killing of military chief Abdel Fatah Younis last month.
But it's now the only game in town and under its own transition plan will run Libya for the next eight months. Even the NTC's chairman, Mustafa Abdel Jalil, has described this option as the "best of the worst."
Any collapse of authority in Libya would have grim implications for its neighbors -- especially Egypt and Tunisia.
Libya has been a source of work for millions of other North Africans. But chaos in Libya would also worry Europe. It could become another route for the flow of drugs from Africa.
Illegal immigration across the Mediterranean is already taxing Italy. And were Islamist extremists, such as al Qaeda in the Islamic Maghreb, to gain a foothold, they would have ready access to Europe.