The wave of revolution started by a young man called Mohamed Bouazizi in the Tunisian town of Sidi Bouzid last December is now set to claim another Middle Eastern dictator, with much of Tripoli, and two of Muammar Gaddafi’s sons, now in the hands of National Transitional Council forces.

The route to victory for the freedom fighters has been very different to that of Tunisians and Egyptians, who were able to maintain non-violent protests in the face of often-ferocious counter-measures from their governments. But neither Zine el Abidine ben Ali nor Hosni Mubarak were prepared to declare war on their own people in the way Gaddafi, and Bashar al-Assad, have.

The six-month campaign to overthrow Gaddafi, which began with Arab Spring-style street demonstrations and then exploded into life with the liberation of Benghazi in February, was at times shambolic, with demonstrators and civilians taking up arms against professional troops and African mercenaries flown in by Gaddafi (to be deployed, some later said they were told, against al-Qaeda). The provision of NATO air power, on the heels of the Security Council’s March 17 resolution authorising the protection of civilians, appeared to narrowly avert the fall of Benghazi to Gaddafi’s armored columns, but thereafter the conflict often seemed to degenerate into a stalemate, with towns such as Brega swapping hands repeatedly. The mysterious death of rebel commander Abdel Fattah Younes, suspected of still being close to his former comrades on the loyalist side, at the end of July, the dismissal of the NTC board and divisions within NATO over the lack of progress against Gaddafi despite a costly air war and steady destruction of his heavy weaponry, seemed to set the scene for a negotiated end. The British and French governments began suggesting Gaddafi could remain in Libya, despite having been indicted by the International Criminal Court for a variety of crimes against humanity, including using r-pe as a weapon of war.

Just a few weeks later, all that is moot. Sudden progress in the west of the country in the past fortnight, and the final seizure of the bitterly contested town of Az Zawiyah, enabled the rebels to threaten Gaddafi’s remaining enclaves from the west, east and south. On Saturday night, Operation Mermaid Dawn started, and continues even now. While initially — the only coverage was via social media — it seemed like a spontaneous uprising against Gaddafi within Tripoli, it turns out to have been probably the best co-ordinated and most successful NTC operation of the conflict so far. Tripoli-based fighters had been training specially for the mission, and had returned with weapons to the city — according to some reports, delivered by NATO naval vessels. They launched dispersed attacks on loyalist forces at several points, backed up by NATO Apache helicopters firing on loyalists flushed out by the NTC attacks. The operation created an instant dilemma for Gaddafi’s remaining commanders — the rate of defections has been increasing rapidly — of whether to redirect forces to quell the uprising within Tripoli or continue to defend against encroachments from the west and the south. But the operation was timed to make that decision impossible, because NTC forces, now just 30 kilometres away, began a simultaneous push into Tripoli from outside.

The operation massively diminishes Gaddafi’s chances of turning Tripoli into a last battelfield, in effect taking the city’s remaining civilian population hostage, and turned inside-out his remaining military advantage, of being able to rapidly reinforce his lines in a circle around the city. At the same time — possibly by co-ordination, but in any event hugely symbolic — the Tunisian and Egyptian governments, both neighbours of Libya, both countries that have sent dictators packing, recognised the NTC as the legitimate government of Libya.

By this morning his son Saif, the highest-profile Gaddafi family member and another one on the docket for a trip to the Hague, was commonly agreed to be in NTC hands. Another son, Muhammad, was reported to have handed himself over but his fate was uncertain after a phone interview by him with Al Jazeera Arabic was cutoff amid sounds of gunfire inside his house. The hated state television broadcaster, on which a newsreader had defiantly waved a pistol yesterday, had fallen. The whereabouts of Gaddafi himself, variously rumoured to have been shot dead, captured, fled the country or in the process of trying to find out which country would take him, remain unknown, although he has produced three audio messages in the past 24 hours first insisting that victory was at hand and blaming French demand for oil for the conflict, then calling for Tripoli to support him, and then insisting he would fight til the end.

Libya is thus on the verge of freedom — a freedom that, based on Libyan history and the behaviour of the NTC so far, is likely to be marked by chaos, conflict and, possibly, more bloodshed. But it’s one to be shaped by Libyans themselves. The NTC has relied heavily on NATO air power but the absence of virtually any Western forces on the ground means this has been an organically Libyan revolution. In retrospect, the Western strategy of confining support to air cover — a product of diplomatic manoeuvring, fiscal constraints, wariness of being trapped in another Middle Eastern conflict, as well as a little strategic good sense — has proven the most effective means of intervention, even if the result took six months. Some leftists will continue to insist it’s a vast Western conspiracy to steal Libyan oil, just as they insisted any intervention was an imperialist plot, but given NATO struggled to put together enough planes to maintain pressure on Gaddafi and there’s no will to put any military pressure on Bashar al-Assad, those arguments looks increasingly the province of the paranoid.

As for Assad, he went on Syrian television yesterday to declare his regime was in no danger and that he was making advances against what he termed “increasingly militant” protesters. Assad has been undertaking a savage crackdown on protests that have cost more than 2000 lives.

The lesson Gaddafi, the Saudis and Assad took from the Arab Spring was that once protests developed a critical mass, either you gave in — like ben Ali or Mubarak — or you responded with brutality. They opted for the latter, like the Iranian regime. For a time it appeared to work in Libya. The NTC struggled to get diplomatic recognition; its first overtures to the world rebuffed, its representatives looking faintly absurd. Now it has fought its way to the cusp of victory. The lesson from Libya is that even an outright declaration of war against his own population may not save a dictator.

And the message for Assad: take a close look at Gaddafi, because you’re next.