Imagine that you, like me, are a typical product of Western liberal democracy, and are invited to give a lecture to a group of Chinese students in Beijing or Shanghai on its benefits. Ignoring the fact that, in reality, the Chinese government would never allow such a lecture, ask yourself: What would you say?

First and foremost, it would be advisable to acknowledge that you do not speak from a position of moral superiority. Western civilization in the first half of the 20th century was not very civilized.

Human rights were trampled. Class war destroyed entire political systems. There were large-scale violent conflicts and much ethnic cleansing. Given this history, Westerners are in no position to lecture on civil liberties or humane values.

It is also worth noting that the global march toward democracy, which seemed nearly inexorable after the fall of the Berlin Wall, now seems to be reversing. According to Stanford University’s Larry Diamond, several countries that were democracies at the beginning of this century have since shifted to different systems.

Of course, elections alone do not a democracy make. Consider those cases when elections empower a majority ethnic or religious group, which then rides roughshod over minorities – an outcome that has been seen all too often in the Balkans, for example.

Then there are the cases when the election of a leader is treated as if it somehow legitimizes the subsequent emergence of dictatorship. This has been the case in Russia, which, since President Vladimir Putin’s first electoral victory in 2000, has become a Potemkin democracy. This year, another election, neither free nor fair, will give Putin another term in office.

In a real democracy, free and fair elections are complemented more broadly by the rule of law, due process, an independent judiciary, an active civil society, and freedom of the press, worship, assembly and association. In fact, it is theoretically possible – though unlikely – for political systems to have all these elements without elections at all. (The political scientist Samuel Finer, in his comprehensive study of different sorts of government, found just one society that was liberal but not democratic: colonial Hong Kong.)

Democracies depend on institutional software, not just hardware. The people who make them work accept a set of norms that often do not have to be codified. The problem comes when the people – or, worse, their leaders – refuse to adhere to democratic norms. That is what is happening today in the United States, as President Donald Trump challenges some of the foundational rules, norms and principles of American democracy.

Trump threatens (as President Richard Nixon once did) to use his power to pervert the rule of law to target his opponents – most notably Hillary Clinton, whom he wants “locked up.” He assaults the freedom of the press, implicitly encouraging supporters to attack journalists, say, by tweeting a (since-deleted) parody video of himself body-slamming a man with a CNN logo on his head. He attempts to subvert America’s system of checks and balances. And he seems to place a higher priority on advancing his family’s own commercial interests than the interests of the American people.

While some parts of America’s democratic political system – for example, the judicial check on executive authority – have proved resilient, others are breaking down.

But Trump is a consequence of this breakdown, not its cause.

The real problem is that the Republican Party has, over the years, become a hollow instrument of lobbyists and extremists, and both Democrats and Republicans seem to have abandoned their commitment to governing by consensus.

As a result, the constitutional brakes that America’s founders created to prevent the election of a huckster like Trump have failed. Propelled by popular discontent with rising inequality and seemingly self-dealing elites, the political system is spinning out of control.

Economic challenges, together with fears about migration, have created similar pressures in Europe, reflected in sizable support for right-wing populist parties in elections in Germany and France in the last year, as well as the rise of “illiberal democracy” in Hungary and Poland.

Countering such assaults on democracy will require political leaders to show courage and vision – as French President Emmanuel Macron has so far – in defending the values that underpin democratic governance. In the European Union, this means that leaders must not turn a blind eye to elected governments’ assault on the institutions that safeguard freedom. After all, the EU not just a customs union; it is a union of shared values. If it fails to act accordingly, it will crumble.

The bad few years that democracies have had is no reason to tout the virtues of dictatorship and authoritarianism. History shows that, when it comes to prosperity and human well-being, societies that defend economic and political freedom come out on top. In the 1930s, some admired Adolf Hitler’s autobahns and Benito Mussolini’s success in getting the trains to run on time. But it was clearly not worth the cost.

The same is true of China today. Yes, the country has become an economic powerhouse in recent decades. But if a system cannot survive basic dissent – from legal challenges to television parodies – can it really be as strong as its leaders claim? And if a crackdown on corruption is carried out by a corrupt dictatorship, can it really be considered legitimate?

Contrast this with India, which may have lost the economic race in the last few years, but has held together since independence, despite vast ethnic, religious and linguistic differences – without needing to create a Bamboo Gulag. This does not mean that there is no dissent or disagreement. But, no matter how much Indians argue, they are not locking up or “disappearing” dissidents, thanks to the safety valves afforded by their democracy. No society can manage indefinitely without such mechanisms. Even Karl Marx, I think, would not have disagreed.