The civil war in Libya went on longer than expected, but the fall of Tripoli came faster than was forecast.
As in Kabul in 2001 and Baghdad in 2003, there was no last-ditch stand by the defeated regime, whose supporters appear to have melted away once they saw that defeat was inevitable.
While it is clear Colonel Muammar Gaddafi has lost power, it is not certain who has gained it. The anti-regime militiamen that are now streaming into the capital were united by a common enemy, but not much else. The Transitional National Council (TNC) in Benghazi, already recognised by so many foreign states as the legitimate government of Libya, is of dubious legitimacy and authority.
There is another problem in ending the war. It has never been a straight trial of strength between two groups of Libyans because of the decisive role of Nato air strikes. The insurgents themselves admit that without the air war waged on their behalf – with 7,459 air strikes on pro-Gaddafi targets – they would be dead or in flight. The question, therefore, remains open as to how the rebels can peaceably convert their foreign-assisted victory on the battlefield into a stable peace acceptable to all parties in Libya.
Precedents in Afghanistan and Iraq are not encouraging and serve as a warning. The anti-Taliban forces in Afghanistan won military success thanks, as in Libya, to foreign air support. They then used this temporary predominance arrogantly and disastrously to establish a regime weighted against the Pashtun community.
In Iraq, the Americans – over-confident after the easy defeat of Saddam Hussein – dissolved the Iraqi army and excluded former members of the Baath party from jobs and power, giving them little choice but to fight. Most Iraqis were glad to see the end of Saddam Hussein, but the struggle to replace him almost destroyed the country.
Will the same thing happen in Libya? In Tripoli, as in most oil states, the government provides most jobs and many Libyans did well under the old regime. How will they now pay for being on the losing side? The air was thick yesterday with calls from the TNC for their fighters to avoid acts of retaliation. But it was only last month that the TNC's commander-in-chief was murdered in some obscure and unexplained act of revenge. The rebel cabinet was dissolved, and has not been reconstituted, because of its failure to investigate the killing. The TNC has produced guidelines for ruling the country post-Gaddafi, which is intended to ensure that law and order should be maintained, people fed and public services continued.
It is far too early to know if this is a piece of foreign-inspired wishful thinking or will have some beneficial effect on developments. The Libyan government was a ramshackle organisation at the best of times, so any faltering in its effectiveness may not be too noticeable at first. But many of those celebrating in the streets of Tripoli and cheering the advancing rebel columns will expect their lives to get better, and will be disappointed if this does not happen.
Foreign powers will probably push for steps towards forming a constituent assembly of some sort to give the new government legitimacy. It will need to create institutions which Colonel Gaddafi largely abolished and replaced with supposedly democratic committees that, in effect, policed his quirky one-man rule. This will not be easily done. Long-term opponents of the regime will find it difficult to share the spoils of victory with those who turned their coats at the last minute.
Some groups have been empowered by the war itself, such as the long-marginalised Berbers from the mountains south-west of Tripoli, who put together the most combat-effective militia. They will want their contribution to be recognised in any new distribution of power.
Libya does have several advantages over Afghanistan and Iraq. It is not a country with a large and desperate part of the population destitute and living on the margins of malnutrition. It does not have the same blood-soaked recent history as Afghanistan and Iraq. For all the demonisation of Colonel Gaddafi over the last six months, his one-man rule never came near rivalling that of Saddam Hussein for savagery.
In Afghanistan and Iraq, the outside powers reacted to military success by overplaying their hands. They treated their opponents vindictively and assumed they had been defeated never to rise again. They convinced themselves that their local allies were more representative and effective than they really were. It is in the heady moment of victory that the ingredients are created which produce future disasters.