Britain’s Brexit vote has shocked the political elites of both the U.S. and Europe. The vote wasn’t just about the EU; in fact, polls before the referendum consistently showed that Europe wasn’t top on voters’ lists of concerns. But on both sides of the Atlantic Ocean, large numbers of people feel that the fundamental contracts of capitalism and democracy have been broken. In a capitalist economy, citizens tolerate rich people if they share in the wealth, and in a democracy, they give their consent to be governed if those governing do so in their interest. The Brexit vote was an opportunity for people to tell elites that both promises have been broken. The most effective line of the Leave campaign was “take back control.” It is also Donald Trump’s line.

In the weeks leading up to the vote, the consensus among bankers, business leaders, and media figures was, “It will be close, but they won’t do it. In the end people will realize their self-interest, vote with their wallets, and stay in.” The experts all agreed: The International Monetary Fund, the Organization for Economic Cooperation and Development, and the Bank of England, along with Nobel laureates and CEOs, all said that Brexit would be bad for the economy, and would hit those who were the least well off the hardest. Hedge-fund managers could always move to Geneva, but people out in the shires and post-industrial heartlands would see jobs disappear, prices rise, and government benefits cut. Why would they vote to leave the EU? This belief is why the pound surged in the days before the vote, despite the close polls, and why the shock to the markets was so severe when the results came back.*

The day after the referendum, “voter stupidity” seemed to be the default explanation traded among elites. There certainly was a lot of misinformation spread during the campaign. But in my own conversations, and listening to voters explain their support for Leave in the media, I heard something different: They are human. And humans don’t always act in ways that are straightforwardly self-interested. In fact, numerous voters said they knew there would be a cost to Brexit—job losses, higher prices, anger from Britain’s allies—but they were willing to pay that price to have their voices heard, to regain a sense of control, and to punish the elites who, they felt, had betrayed them.

People are what behavioral economists call strong reciprocators and altruistic punishers. Humans are wired for reciprocal cooperation: Do unto others as you would have them do unto you, I’ll scratch your back if you scratch mine, etc. Our hunter-gatherer ancestors lived in small groups, for whom cooperation was essential for survival. A key step in human development was when people expanded this circle of cooperation from close kin to strangers through trade, customs, religions, alliances in warfare, and eventually through laws and institutions. Modern society is a vast intricate web of cooperation.

But cooperation also creates the potential for cheaters, for those who don’t reciprocate and keep their end of the bargain. Humans are thus also wired to be altruistic punishers—not altruistic in a nice sense, but altruistic in the sense that they will punish people, even to their own harm, to enforce fairness. Behavioral economists show this through a well-known experiment called the Ultimatum Game, in which one person is given some money (say $100) and asked to offer a share of it to another person (say $20). If the second person accepts the offer, both keep the money, but if he or she rejects it, both get nothing. The rational solution is to accept any offer except $0, as even $1 is better than nothing. But experiments on thousands of subjects around the world show that offers below around 30 percent are typically rejected, thus harming both individuals.

This willingness to self-harm might make sense in the context of a repeated game—it can enforce cooperation and fairness over time. But the behavior persists even when it is made clear that the money exchange is a one-off interaction. People will sacrifice their own self-interest and harm themselves, even severely, to enforce norms of reciprocity. We see this not just in the lab but in the real world: hopeless lawsuits pursued to the point of self-destruction, workers suffering through lengthy labor strikes, nations descending into trade wars—or real wars.

These feelings help explain why immigration was such a controversial issue during the Brexit campaign, just as it is currently in the U.S. No doubt, xenophobia and racism were motivators for a minority of voters. Jo Cox, a member of Parliament and Remain advocate, was horrifically killed by an avowed racist during the campaign, and attacks on immigrants and minorities spiked 57 percent in the days after the vote. But for the majority of Leave voters, the immigration issue was perceived as one of reciprocity and a loss of control. Rightly or wrongly, many voters felt immigrants have been getting a better deal in terms of jobs, benefits, and public services than they were. They felt immigrants were unfairly “jumping the queue.” And they felt the country had lost control of its borders.

The reason the Remain camp lost was that they didn’t understand the game they were playing. They thought they were playing a rational game, appealing to people’s pocketbooks and sense of security. They fought their campaign with facts and figures and by highlighting the risks of Brexit. But the voters were playing the Ultimatum Game. Leave understood this and fought with promises to “take back control.” Like the Remain campaign, Hillary Clinton is also playing the rational game, appealing to voters’ economic and security self-interest. Donald Trump is the weapon of the altruistic punishers. Clinton needs to recognize that voters are not playing the same game she is. She needs to convince voters that she hears them and will restore the fundamental promises of capitalism and democracy. If she doesn’t, November 8 might be as shocking a day as June 23.**

* This article originally stated that the pound hit “record” highs on the day before the vote. We regret the error.

** This article originally misstated the date of the 2016 U.S. presidential elections. We regret the error.