It's panic time in Punditville.

Democracy itself is stumbling. Up against the ropes. Americans had to select between two candidates they despised and picked the psychopath over the sold-out establishment hack.

In Europe, popular sentiment is turning away from open, inclusive, liberal values back towards tribalism, with far-right parties on the rise. In Turkey, President Recep Tayyip Erdogan is imprisoning journalists and cracking down on the voices of dissent. The Arab Spring's dream of democracy barely hangs on in a single country, Tunisia.

Everywhere else, it has ended with the return of an autocrat, chaos, and civil war. Russia shuffles steadily deeper into Putinism, best described as Stalinism Lite, with western consumer goods and billionaires. The more authoritarian he gets, the more he is admired and seen as a model.

The Philippines elected a developing world version of Donald Trump, which is to say, that much cruder, and leading a campaign of extrajudicial killings.

Democracy v liberal democracy

There's democracy. And there's liberal democracy.

Democracy is about voting and majority rule.

The ancient Greeks, who invented democracy, or at least the label, feared the system. The mass of the people - the mob - were uneducated, emotional, and easily swayed. They would vote for hysterical, disastrous wars. They would vote themselves out of democracy into tyrannies. The poor were many, the rich were few, so if the poor had any sense, they would vote to rob the rich.

America's founding fathers, who are among the inventors of modern democracy, had the same fears. John Adams, the second president, said, "Democracy has never been and never can be so durable as aristocracy or monarchy … It soon wastes, exhausts, and murders itself. There never was a democracy yet that did not commit suicide."

Part of the reason that systems fail is that people learn how to game them. The more successful a system is, and the less opposition there is, the more likely this is to happen.

So, instead, they put together a system with voting for representatives who would then, in turn, make the actual laws, with checks and balances to slow things down, rights reserved for individuals, and especially for property.

They used the word "republic" to distinguish it from everyone-gets-to-vote-on-everything democracy. We no longer do so. If we wish to make a distinction between the voting per se, and voting within a system that has the rule of law, certain guaranteed freedoms and protections, and the rest, we call it "liberal democracy".

Embracing total ignorance

This American version turned out to be the longest-standing government in the world and the model, sometimes in reality, sometimes rhetorically, for most others.

In the early 1990s, its last, serious rival, communism, gave up and died. Democracy - together with capitalism - was the last system standing, "the end of history", the final solution to organising nations.

At that point, three other fundamental principles of human behaviour began to take over: "the ignorance of the arrogant", "success is failure", and "gaming the system", each best defined with an example.

OPINION: US election - What happened?

The underlying flaws of the second Gulf War, all came from the arrogant assumption that democracy and capitalism were not merely preferable; they were so wonderful that they were the default systems, which humans would automatically adopt.

All that had to be done was remove the obstacles in the way. With Saddam Hussain and his cronies gone, Iraq would instantly become a successful capitalist democracy.

It was as if there had been a fervent embrace of total ignorance. Mind you, it was quite widespread. Virtually no one was shouting that there are a multitude of elements required - a history, a substructure, a set of cultural understandings, a legacy of attempts, failures, and learning - to make any system work, let alone ones such as democracy and capitalism that require such great degrees of individual compliance and acceptance to function.

Virtually no one said, "slow down, you better look to the history, to America's Civil War, its small internal rebellions, its crashes and failures."

Actually, it was a worldwide delusion. From Russia to Libya, people everywhere believed that, if they held an election and privatised their state industries, it was almost as sure a ticket to a national paradise as dying as a martyr for your God was to a private one.

Entire nations lunged forward as if it were true. In Russia, it unleashed gangster capitalism. In Central Asia, the former Soviet nations elected leaders who immediately became presidents for life.

In the Middle East, the autocrats held on, or it ended in civil war, or both. Only those territories physically close to Western Europe, with traditions of democracies and capitalism that had been interrupted by communism, made the transition with relative success.

The need to re-invent democracy

In the meantime, systems contain the seeds of their own demise. For half a century, General Motors was the largest, most successful car maker in the world. Naturally, such a triumphal track record made them reluctant to change. But the world did, and as it did, the same ideas and methods led them to bankruptcy.

In the case of the car industry, the issue was the refusal to change in the face of new competition. With democracy and capitalism, it was the loss of competition that created the problem. Without the Soviet challenge to unite all players against a common enemy, democracy in America became free to indulge in ever increasing partisanship.

They didn't even have to fear becoming completely dysfunctional. Without a competing example, the US turned away from the welfare state that had balanced against the excesses of capitalism.

Part of the reason that systems fail is that people learn how to game them. The more successful a system is, and the less opposition there is, the more likely this is to happen.

OPINION: The hidden force of current international uneasiness

By 2000, it was fair to say of the US's two political parties, that one represented money and the other sold-out to money. As congressman Alan Grayson put it, "one of the last debates left to us, is the debate between those who think that America is an oligarchy and those who think it's a plutocracy."

This year, voters all over did what the early Greeks and America's founders feared. They engaged in democracy. They voted. The mob voted against what the elites wanted. Those votes had all the qualities that Plato or John Adams would have expected, they were emotional, intellectually unsophisticated, even ultimately undemocratic.

Command systems - whether monarchies, dictatorships, dictatorships of the proletariat, or theocracies - can only decline and keep declining, or end in violence.

Democracies, so long as they stay democracies, can re-invent themselves. Endlessly. In spite of the failures, the absurdities and the excesses, ultimately, I still vote for democracy.

Larry Beinhart is a novelist, best known for Wag the Dog. He's also been a journalist, political consultant, a commercial producer and director.

The views expressed in this article are the author's own and do not necessarily reflect Al Jazeera's editorial policy.