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.