It wasn’t supposed to happen this way. After the Soviet Union’s collapse in 1991, democracy was supposed to be irresistible. While some of us were more skeptical than others, even cynics allowed that freedom seemed to have the upper hand.

Instead, barely a quarter-century along, democracy and political freedoms are newly embattled, as one society after another defaults to reborn tyranny, striding behind religious extremism, xenophobic nationalism — or both.

On Sunday, Vladimir Putin was re-elected as Russia’s president with almost 77 percent of the vote. With his relentlessly propagandized image at home, Putin would have won a free election, but that wouldn’t have been enough: He feels the need of an unassailable mandate, of recognition as his country’s savior. So serious opposition candidates were excluded (and one murdered), while ballot box stuffing was shameless. Czars are just that way.

Days earlier, China’s President Xi Jinping engineered his lifetime tenure (he didn’t bother with the charade of a nationwide vote). Xi’s the most powerful leader China has had since Mao in his heyday, and Mao cost China tens of millions of lives.

In NATO member Turkey, President Recep Tayyip Erdogan, a would-be sultan, has dismantled the constitution; jailed tens of thousands of opposition members; staged massive show trials; destroyed freedom of the press; attacked minorities; empowered religious fanatics; and, now, invaded Syria not to defeat the remnants of ISIS, but to crush our Kurdish allies.

In Egypt, where democracy came and went in a blink, President Abdel Fattah al-Sissi rules ruthlessly, while Syria’s Bashar al-Assad has survived every prediction of his fall. In Iran, Ayatollah Ali Khamenei, unelected, remains the undisputed ruler.

Even Kim Jong Un, a tin-pot despot, has gained international recognition at a level his predecessors never achieved.

In NATO and European Union members Hungary and the Czech Republic, strongmen dominate the political scene. Romania and Slovakia struggle to maintain democratic forms, and even Poland has seen its constitution undermined. Corruption, tyranny’s handmaiden, is everywhere.

In Italy and France, pro-Putin, neo-fascist parties are political forces to be reckoned with, while Moscow also backs far-right parties in Germany and Austria.

Much of this subversion traces to Moscow and Putin’s new model of tyranny. An old KGB man, Putin had the genius to recognize that the last century’s police states went too far and wasted resources by dissecting private lives. Human beings need to complain, and Putin’s compact with his people is that they can bitch all they want in the kitchen or bedroom, but they can’t bring their complaints into the street.

Russians find that acceptable.

Xi made a similar compact, based on material progress and minor liberalization. Today’s tyrants (other than Kim) aren’t interested in controlling every thought: They’re content to control behavior.

Another reason tyranny is resurgent has to do with human nature, which we in the West idealize. Not everyone sees freedom as their top priority, preferring security (a lesson we should have learned in Iraq). Populations unschooled in our traditions equate freedom with anarchy — and act accordingly: Russians have third-degree burns from the 1990s.

Tyrants may oppress you. They may lead you into disastrous wars. But they don’t demand that you take personal responsibility, that great burden of democracy. And every tyrant worth his salt provides scapegoats for his people’s failures: It’s never your fault, it’s them. It’s a message demagogues promote even here.

Tyrants offer certainty. All you have to do is let them run things. It’s a deal too many humans gladly embrace.

Meanwhile, freedom means insecurity, and democracy signals chaos to unprepared societies. As we’ve seen for almost three decades now, the sudden imposition of democratic forms on traditional societies is like handing a child a grenade.

What does this mean for us, apart from the obvious dangers around the world?

We need to stop whining and be grateful for the freedoms we enjoy, our countless privileges as Americans and our remarkably effective government. In perilous times such as these, when domestic demagogues cherry-pick the Constitution and even a president displays impatience with our laws, we must put the Constitution above party and personal biases, above all else.

That document is our sole guarantee that tyranny won’t come here, and that’s why our military takes an oath to the Constitution, not to an individual.

If we lost all else but kept the Constitution, we’d still be the greatest country in the world.

Ralph Peters is a retired Army officer and former enlisted man.