Libya's revolution has succeeded but now reconstruction begins. This means restoring normal life after bloody fighting, repairing physical damage, building a new government underpinned by democracy, ordering the economy to minimize corruption and use the country's wealth fairly between regions and classes, and legislating for a free society built on the rule of law and freedom of expression.
It is a daunting agenda but Libyans have tremendous assets for addressing it. First, it has been a Libyan revolution and the new rulers will not be tainted by association with a foreign military occupation. The manner of Gaddafi's end will make him a martyr to only a handful of people. For the majority, his death draws a line decisively under the past.
Above all there is Libyan national spirit, community cohesion and talent. There is momentum behind the civilian leadership provided by the National Transitional Council – an embryonic government that controls vast financial reserves, is bringing the oil and gas industries back on stream and can maintain the transfer payments and salaries on which millions depend. The NTC is already signing reconstruction contracts, and the international reception could not be warmer, with many offers of practical support from abroad. Libyans will build the capacity to use help without being swamped by it.
The outlook for security is good: Gaddafism is done for without Gaddafi. There is no ideological, regional or religious basis for continued fighting. There may be some attacks but had Gaddafi survived, there would have been more of a risk of gangsterism and of hold-outs carrying out hit-and-run raids.
There will be a general instinct to cooperate with the new government, the police and the victorious armed forces. Libyan towns and the Libyan desert are likely to be as safe as or safer than equivalents in other North African countries. The foreign workforce will return when progress is seen to be underway. Key contracts and investments on the man-made river water supply, and in the oil and gas fields will resume. The private sector will break free of the 'security companies' and Gaddafi-family strong-men.
The difficulties ahead are also clear. A balance has to be struck between accountability for the misdeeds of members of the old regime and the need to keep well-qualified people in the infrastructure of the country.
High expectations of a new life for the country and new openings for citizens have to be met. Where they are unachievable in the short term, the authorities will have to explain why.
The principles of the new order have been laid down by the NTC. The promised interim government will be announced shortly, assuming recent difficulties over exact individual responsibilities have been resolved. The transition will start formally. That is not a problem.
Putting the excellent proclaimed ideals in practice while preserving unity will be harder. The armed forces council has to corral together diverse units and commanders, and agree a way of working with the government that gives primacy to civilians while guarding against any security threats. It isn't clear just how rocky that road will be, or how easy it will be to resolve any rivalries and dissent that arise. There can however be confidence that much will go right from now, while expecting to see some setbacks.
Later, when it comes to forming political parties, there will be a relatively chaotic period in 2012 during which the premium will be on presenting a coherent programme under convincing leaders. The Muslim Brotherhood has a head-start, but a majority will prefer a non-sectarian government that commits to Islam, if it is offered convincingly.
We do not know who the first leaders of such potentially influential political groups will be. They are probably lying low now. Some who see themselves as front-runners will be hoping to avoid being tainted with the difficulties, compromises and potential failures of the pre-electoral period.
Is Libya a precedent for foreign involvement in other Arab countries?
Probably not, as Libya presented a rare alignment of a convincing popular request from the victims of villainous government, international friendlessness (other than among Gaddafi's clients in Africa), regional support for intervention with international legality established through the UN Security Council, and a relatively modest military task coupled with a convincing exit strategy for outsiders.
David Cameron's line after Gaddafi's death was right: no crowing, no lectures about the way ahead that Libyans have already mapped out, an understanding that this has been a Libyan achievement but saying so with justifiable satisfaction in the share foreigners took, acknowledgment of Gaddafi's victims in Libya and elsewhere including the UK, and readiness to go on supporting the transition.
Promoting UK interests in the new Libya will also require the right approach. British companies will find more competitors than ever trying to get in to Libya. The Lockerbie and Fletcher cases remain open and the UK, Scottish and Northern Irish governments will seek further assistance from Libya in establishing the full facts. But patience is required. Asking the right questions at the wrong time risks the wrong answer.
The overwhelming priority of the new Libyan government will be their own innumerable casualties and the challenges facing a nation reborn.
Libya's New Era: Lessons from Iraq