Imagine someone gets caught cheating at a poker game. What’s next? After the accusations and denials, the cheater usually suffers some form of harm – confiscated winnings, ridicule, maybe ostracism. Perhaps justifiably so: most people think that cheaters deserve punishment.

This is a familiar sentiment. Humans are quick to recognise wrongdoing and to mete out penalties in response. Sometimes, we seem to enjoy the act of retribution. Punishment takes diverse and complex forms, ranging from mocking laughter to imprisonment. Sometimes, the affronted party does the punishing; other times it’s a third party.

Yet it’s also costly to give someone their just deserts. When an adult confiscates a child’s toy for bad behaviour, both are in for a rough afternoon. Which raises the question: why do we punish in the first place?

One answer is that punishment evolved to promote the greater good and prevent tragedies of the commons. This is the altruistic approach. Yes, punishment might be costly for the punisher, but (so the theory goes) it generates downstream benefits for others – stabilising cooperation, enforcing just rules, deterring freeriders. Punishment is probably essential for maintaining and enforcing norms, laws and customs. Yet its origins appear to trace back to a time before robust human societies, perhaps even before we had language to articulate the rules. Recent research has identified contexts where dominant chimps seem to punish freeloaders. So perhaps punishment preceded the benefits it generates.

After all, punishment doesn’t always promote the greater good. It’s been used to oppress minorities, foster discrimination, exploit disadvantaged groups, maintain sexist and racist social norms, and keep subjugated populations in line. In experimental setups, ‘antisocial punishment’ has been observed, in which cooperative individuals are punished by others because they contributed to a public good. Punishment can be detrimental, even in the long run.

These observations suggest that altruism is, at best, only a small part of the story. Moreover, even if punishment is crucial for achieving some forms of social cooperation, it might not have originated for that reason. Instead, perhaps it came about for another reason entirely, and only later assumed a socially beneficial role.

So, if not for the greater good, just how did punishment evolve?

One intriguing possibility can be found in early research on the evolution of social behaviour. The British evolutionary biologist William Hamilton, in his seminal theoretical work of the 1960s, categorised different social actions based on their consequences for creatures’ adaptive fitness. Altruism, according to him, is behaviour that imposes a cost on the actor and confers a benefit on a recipient. Punishment just doesn’t fit, in part due to the diffusive nature of the benefit that it’s supposed to generate. It fits more readily into another category Hamilton identified: spite. Spiteful behaviour imposes a cost on the actor and inflicts harm on the recipient.

Could punishment have originated as a kind of spite, rather than as a scaffold for social harmony? Spite evolves in situations where organisms pay an absolute cost to generate a relative advantage; having one fewer offspring can be evolutionarily advantageous if it means that others have even fewer. Spiteful actions appear at many levels of biological organisation, ranging from fish, to macaques and, of course, to humans. From an evolutionary perspective, spite is about levelling the playing field by taking everyone down, in order to get a leg up for oneself.

Once we see the potential connections between spite and punishment, we open a window onto a range of new evolutionary hypotheses about punishment’s origins. Causing harm, based on group membership or some shared trait, might have evolved first, without a clear, tangible benefit. Once established, this sort of behaviour could then be coopted to enforce cooperation – or anything else for that matter, including bad or oppressive norms. Indeed, decoupling penalties from cooperation helps to make sense of such antisocial structures: if punishment evolved as a form of directed harm, there’s no obvious reason to suppose it would necessarily be aimed only at cheaters.

When we survey nonhuman social behaviour, we see peculiar instances of what looks like punishment. Consider Pseudomonas aeruginosa: these fascinating bacteria display a form of spite by producing costly and harmful toxins. Moreover, researchers have shown that spite in populations of P aeruginosa is tied to the prevalence of ‘cheats’ that fail to produce beneficial siderophores (iron-carrying compounds), thereby incentivising cooperation. There are numerous other examples. Honey bees police egg-laying. Imported red fire ants use pheromone markers to find and kill individuals that are genetically distinct. These examples suggest that there could be a wide range of punishment-like behaviours geared towards inflicting harm.

A significant amount of current empirical and theoretical work focuses on the role of punishment in scenarios concerning public, shared goods. While this work is important, especially for thinking about humans, these studies suffer from a kind of myopia.

Consider a different well-studied scenario: the ultimatum game. In this setup, two players must decide how to divide a resource. One gets to propose a split, the other can accept the offer or reject it. If the offer is accepted, each gets his share specified by the proposal. If the offer is rejected, both parties receive nothing. The economically rational solution to this game is to offer as little as possible, and accept any offers that are made. When humans play this game, however, they frequently make offers that are more equitable and often reject those that are unfair. Such rejections are often interpreted as punishment aimed at enforcing fairness.

Yet fair behaviour in the ultimatum game doesn’t generate any net benefits over exploitative strategies. On average, the economically rational and unfair solution does just as well as the fair one. Perhaps fairness (and its enforcement) is not about making everyone better off, but about making sure the other guy doesn’t get more than you. That makes it hard to see rejections as a form of altruism. Rather, they look like costly behaviour that decreases the payoff for everyone involved: spite, in other words. Under evolutionary conditions known to favour spite rather than altruism, more equitable behaviour tends to emerge. Additionally, empirical studies have shown that there’s a wide array of cultural variation in response to the ultimatum game.

Given the complexity of punishment, it’s improbable that the phenomenon has a single evolutionary explanation. Not all punishment serves to promote a greater good – and even when it does, it might not have originally evolved for that purpose anyway. We should take seriously the possibility that even virtuous penalties have vicious origins.

If so, this can help to explain a number of notable tendencies. We tend to punish even when it is ineffective; we punish some groups more than others; and punishment is often disproportionate to the offence. Many of us view this as problematic only after some careful reflection. If we get a better grasp on the origins of punishment, we might understand why so much of our behaviour causes more harm than good.