In the history of modern brutal dictatorships, the 42-year rule of Moammar Gadhafi over the North African nation of Libya had its unique aspects.

Unlike similar leaders, he styled himself as “colonel,” his rank when he peacefully overthrew the former king, not “generalissimo” (supreme general), let alone “president for life.”

Yet that’s what he effectively was. His rule was absolute, and the blood shed to preserve it ran just as red as that shed by other dictators whose records marred nearly the entire 20th century and still run into the 21st.

His support for terror abroad ran hot and cold, including the Lockerbie Pan Am Flight 103 bombing in which 270 people died, and the 1986 bombing of a disco in West Berlin in which two U.S. soldiers and a Turkish woman died and 200 people were injured.

President Reagan’s retaliation for that was immediate, and Gadhafi’s terror support had greatly subsided even before the capture and execution of Saddam Hussein in Iraq, an event that led him to renounce an attempt to create nuclear weapons. But he still repressed his own people, and that repression finally produced revolt.

Now he is dead, slain by those who suffered under him. His death was as brutal as his reign, and those who hold to the rule of law and of the vital procedural rules found in well-developed systems of criminal justice can easily find much to deplore in the way he was beaten and executed by his captors.

Revolutions are not conducted according to the rules established by mature democracies, however.

Outsiders have to weigh the extremely harsh justice he was apparently meted out by a band of armed fighters with what might have happened had he escaped the country and used the financial resources he had reportedly stashed abroad to foment new conflicts at home.

Yes, it would have been far better if he had been captured and put on trial, as Saddam Hussein was publicly tried before receiving a death sentence from a properly constituted Iraqi court.

But if the “Arab Spring” is to gain a foothold in Libya, and in all the other Mideast nations now undergoing similar conflicts whose outcomes remain uncertain even after former autocratic leaders have been deposed, those leaders need to be rendered incapable of restoring one-man rule.

That is only the first step, however. There is no guarantee that Western-style democracy will magically spring up in an area where Islamic radicals have considerable influence.

Thus, the foreign policy goals of the United States and its European allies should include measures aimed at identifying and strengthening those elements of society in nations now in turmoil who can best bring stability — and even some measure of freedom — to their long-repressed peoples.

Without that, both their hopes and our future may be far bleaker, especially if a system of repression based on the power of one man is replaced by a system of repression based on the power of many people — those for whom “democracy” and “liberty” are not ideals, but objects of scorn.