What conditions favour egalitarianism, that is, muted hierarchies with relatively equal distributions of resources? Here, we combine the hawk–dove and prisoner’s dilemma games to model the effects of economic defensibility, costs of competition and gains from cooperation on egalitarianism, operationalized as the absence of hawks. We show that a ‘leveller’ strategy, which punishes hawkishness in the hawk–dove game with defection in the prisoner’s dilemma, can be evolutionarily stable provided that the gains from cooperation are high relative to the benefits of hawkishness. Under these conditions, rare mutant levellers select for hawks that acquiesce to punishment by playing dove. If these ‘acquiescent hawks’ become common, levellers outperform hawks and establish a new egalitarian equilibrium. An analysis of human foraging groups corroborates these results, as groups with a greater reliance on cooperation are more egalitarian. Cooperation fosters greater equality when individuals can withhold its benefits from would-be dominant individuals.