Jair Bolsonaro, the frontrunner for the Brazilian presidency, is a far-right, gun-loving, media-baiting hyper-nationalist. The fact that he would be right at home among many of today’s global leaders including the leaders of some of the world’s major democracies should worry us all. This compels us to address the question: Why is democracy faltering?

We are at a historical turning point. Rapid technological progress, particularly the rise of digital technology and artificial intelligence, is transforming how our economies and societies function. While such technologies have brought important gains, they have also raised serious challenges and left many segments of the population feeling vulnerable, anxious, and angry.

One consequence of recent technological progress has been a decline in the relative share of wages in GDP. As a relatively small number of people have claimed a growing piece of the pie, in the form of rents and profits, surging inequality of wealth and income has fueled widespread frustration with existing economic and political arrangements.

Gone are the days when one could count on a steady factory job to pay the bills indefinitely. With machines taking over high-wage manufacturing jobs, companies are increasingly seeking higher-skill workers in areas ranging from science to the arts. This shift in skill demand is fueling frustration. Imagine being told, after a lifetime of bodybuilding, that the rules have been changed and the gold medal will be awarded not for wrestling, but for chess. This will be infuriating and unfair. The trouble is that no one does this deliberately; such changes are the outcome of natural drift in technology. Nature is often unfair. The onus for correcting the unfairness lies on us.

These developments have contributed to growing disparities in education and opportunity. A wealthier background has long improved one’s chances of receiving a superior education and, thus, higher-paying jobs. As the value of mechanical skills in the labor market declines and income inequality rises, this difference is likely to become increasingly pronounced. Unless we transform education systems to ensure more equitable access to quality schooling, inequality will become increasingly more entrenched.

The growing sense of unfairness accompanying these developments has undermined “democratic legitimacy,” as Paul Tucker discusses in his book Unelected Power. In our deeply interconnected globalized economy, one country’s policies such as trade barriers, interest rates, or monetary expansion can have far-reaching spillover effects. Mexicans, for example, do not just have to worry about whom they elect president; they also need to concern themselves with who wins power in the U.S. an outcome over which they have no say. In this sense, globalization naturally leads to the erosion of democracy.

Against this background, the ongoing transformation of politics should not be surprising. The frustration of large segments of the population has created fertile ground for tribalism, which politicians like Trump and Bolsonaro have eagerly exploited.

Mainstream economics is founded on the assumption that human beings are motivated by exogenously given preferences what economists call “utility functions.” Though the relative weights may differ, all individuals want more and better food, clothes, shelter, vacations, and other experiences.

What this interpretation fails to account for are “created targets” that arise as we move through life. You are not born with an essential drive to kick the ball through a goal post. But once you take to soccer, you become obsessed with it. You do not do it to get more food or clothes or houses. It becomes a source of joy in itself. It is a created target.

Even becoming a sports fan is similar. Nobody is essentially a devotee of Real Madrid or the New England Patriots. But, through family, geography, or experience, one might become deeply connected to a particular sports team, to the point that it becomes a kind of tribal identity. A fan would support players not because of how they play, but because of the team they represent.

It is this dynamic that is fueling tribalism in politics today. Many who support Trump or Bolsonaro do so not because of what Trump or Bolsonaro will deliver, but rather because of their tribal identity. They have created targets related to being part of “Team Trump” or “Team Bolsonaro.” This damages democracy by giving political leaders a license they did not have earlier. They can do what they want without being constrained by the will of the people.

It is not immediately clear how we can rectify these problems, protect the vulnerable, and restore democratic legitimacy. What is clear is that business as usual will not cut it.

The Industrial Revolution another major turning point for humankind brought massive changes in regulations and laws, from the various Factories Acts in the U.K. to the implementation of income tax in 1842. It also brought the birth of modern economics, with major breakthroughs by the likes of Adam Smith, Augustin Cournot, and John Stuart Mill.

But we are at a historical juncture where the subject of political economy deserves a rethink. The dinosaur did not have the capacity for self-analysis and headed toward extinction 65 million years ago. We, too, run the risk of civilizational collapse. But, luckily we are the first species with the capacity for self-analysis. Therein lies the hope that, despite all the turmoil and conflict we see around us, we will ultimately avert the “dinosaur risk” and pull ourselves back from the brink.