As of this morning, Colonel Muammar Gaddafi may still be holed up in his compound in Tripoli, but there is no longer any doubt that the Libyan civil war has been fought and won, and whatever remains are just mopping-up operations. And with that, the media narrative has moved almost seamlessly from “military stalemate” to “uncertain future under rebel government”.

As late as yesterday the BBC was featuring a story headed “No easy endgame in Libya“, which assured us that “a march on Tripoli would not be simple”. Other pundits told us that the conflict would inevitably draw in NATO ground forces, or that it would result in a semi-permanent division of Libya.

The new narrative — with no admission, of course, that the old one has been spectacularly falsified — warns us that  “Getting rid of Gadhafi is the easy part“, and conjures up all sorts of dangers for Libya’s future, ranging from tribal divisions to mob rule, terrorism, Islamic fundamentalism and further Western intervention.

Now of course these dangers are not entirely fictitious; there may be problems ahead for Libya. But it’s hard to explain the persistent note of pessimism. It’s almost as if people have been listening to Abdullah Al-Snousi, Gaddafi’s head of security services, who told reporters yesterday that NATO forces “are fighting with terrorism against the Libyan nation and they are following al-Qaeda’s orders”.

Some pundits have ulterior motives, such as mad Daniel Pipes, who sees a “radical Islamist” behind every rock. Others have been so traumatised by the Iraq experience that they react against Western military action of any sort. See, for example, Matt Welch at Reason, who also invokes Kosovo — apparently quite unable to see the difference between starting a war and intervening to assist people who are already fighting one.

But most of the pessimism seems basically non-ideological. Perhaps it’s a professional hazard for journalists, used to seeing the worst in everything, cynical about happy endings and sceptical about beliefs of any sort, including belief in democracy.

Whatever the cause, the assumption that things in Libya will quite probably turn pear-shaped certainly has some historical precedent. Many dictators have been overthrown by popular revolt and/or foreign intervention, only to be replaced by something that turned out just as bad.

Some readers will remember 1979, which was a particularly bad year in that regard. Three of Africa’s worst dictators — Idi Amin, Jean-Bedel Bokassa and Macias Nguema — were deposed, but none of their countries went on to experience democracy. And the fall of the Shah in Iran became almost a paradigm case of revolution disappointed.

But all these examples date from the Cold War, when superpower rivalry kept a lid on change. Over the past 25 years or so, the record has been much better. Starting with the Philippines in 1986, there have been numerous cases of tyrants being replaced by functioning democracies — eastern Europe on its own furnished a raft of examples. Unless one adopts the position that Arabs are congenitally unsuited to democracy, there seems no particular reason why Libya, and for that matter Egypt and Tunisia, should go down the same route.

That doesn’t mean everything will be plain sailing, just that there is good cause for optimism. Certainly the new government in Libya has so far made all the right moves, stressing the need for reconciliation and broad-based democracy. The fact that pretty much everyone agrees that Gaddafi was crazy and a clean break from his rule is necessary should make those tasks easier.

A good comparison may be with Romania after the revolution of 1989. Democracy did not come immediately or painlessly, and for several years observers worried that the country was sliding back into gangsterism. But no one wanted to return to anything like the old regime, and eventually things settled down. Romania has since been integrated into the European mainstream (with EU membership since 2007) and enjoys economic growth and stable parliamentary rule.

And if Gaddafi himself meets the same fate as Nicolae Ceausescu, it might serve as a salutary warning for the Middle East’s surviving despots.