Analysis: Why Gaddafi's crack troops melted away
When one Libyan opposition activist reflected on the rebel advances into the city of Zawiya last week, he mused that "Eid could be a massive celebration indeed". He was wrong - the jubilation came much earlier.
As Tripoli was surrounded from three sides - east, south and west - government forces precipitously collapsed.
What at first might have been mistaken for a tactical withdrawal into urban areas, emerged more clearly as the disintegration of the government's most feared fighting units.
The vaunted Khamis Brigade - commanded by a son of Col Gaddafi - saw its barracks raided with impunity. Rebel convoys punched deep into Tripoli, meeting virtually no resistance.
Why did battle-hardened Libyan soldiers, fed on a diet of anti-rebel propaganda and willing to fight in the face of overwhelming Nato air power, melt away so suddenly?
The answer can only be speculative at this stage, but there are a few possibilities.
First, there was an element of retreat rather than a rout. Tripoli is unevenly pacified and the euphoria of Green Square obscures the continuing fighting in several suburbs.
Western parts of the city are being progressively secured but enduring sniper fire shows that loyalists still remain willing to risk their lives for a crumbling regime.
Second, where soldiers did lay down their arms, the much-maligned National Transitional Council (NTC) deserves some credit.
Col Gaddafi's presidential guard surrendered in line with agreements it had earlier reached with the Benghazi leadership.
Over the past three months the NTC reportedly worked with Nato to arm underground groups in Tripoli.
As the noose tightened around Tripoli, these and other dissidents felt empowered to begin confronting the city's security forces.
Hence the weekend's patchwork urban revolts, some of them possibly cued by messages sent from mosques.
A remarkable amphibious assault on Tripoli demonstrated the extent of planning that underlay rebel operations, both in and outside of Tripoli, in recent days.
Third, Nato's relentless pounding of armour and artillery east of Zawiya greatly softened up government units, breaking down much of the resistance that would otherwise have slowed the rebel path.
As the war began to revolve around the periphery of the capital, Nato could concentrate its surveillance assets (including Predator drones) and firepower on smaller areas, exploiting intelligence transmitted directly by rebels on the ground.
On Saturday, three-quarters of all Nato targets were in the capital.
The role of Western special forces in forward air control (to guide air strikes) and rebel training is not yet understood, but seems likely to have been extensive.
This detracts nothing from the organic character of the NTC, but underscores the decisive impact of Nato's decision to serve as the rebel air force.
What about the aftermath? The possibility of ad hoc retributive justice is inevitable in post-revolutionary environments.
It would be naive to discount the possibility of serious violence, but talk of a bloodbath looks overblown. The hundreds of rebels who flooded the streets of Tripoli have so far shown no interest in mass vengeance.
Nonetheless, the NTC is under unprecedented international and Libyan scrutiny, and will be held responsible even for isolated abuses by forces nominally under its command.
Even small provocations could see the group outflanked by political competitors with their own claims to representing aggrieved groups.
Nato member states have little appetite for a peacekeeping force. They believe that a Western military footprint would inflame regional tensions.
Nor is the NTC eager for something that would further complicate efforts to establish its authenticity and independence.
The UK and France know that this revolution requires ownership, particularly as details of Nato's expansive role trickles out over the coming months. But unobtrusive and discreetly supplied advice on urban policing and the disarmament of militias would be helpful.
One crucial task is the swift repair of damaged oil and gas infrastructure. The restoration of export revenues would finance reconstruction and provide the transitional government with the resources to meet high expectations.
But even this requires sensitive policy - any suggestion that an interim and unelected government was apportioning revenue unfairly could poison the process of institution building. Iraq's difficulties in this regard should furnish important lessons.
In the longer-term, there is a paradox to Libya's revolution. The same factors that gives rise to a power vacuum - the absence of national institutions and an independent military establishment - could also enable the creation of a new Libyan state, free from predatory vested interests of the sort that are buffeting Egypt's democrats.
The NTC's draft constitution is an impeccably liberal document, promising to fill that vacuum with inclusive and pluralistic structures of government.
That promise may flounder on the cross-cutting tribal, religious and regional fault-lines of Libya's war, but its best prospect of redemption lies in persuading the wary that their best chance of equitable treatment lies in the restoration of political authority.
Shashank Joshi is an Associate Fellow at the Royal United Services Institute (RUSI), a defence think tank, and a doctoral student of international relations at Harvard University.