The existence of cooperation and social order among genetically unrelated individuals is a fundamental problem in the behavioural sciences. The prevailing approaches in biology and economics view cooperation exclusively as self-interested behaviour--unrelated individuals cooperate only if they face economic rewards or sanctions rendering cooperation a self-interested choice. Whether economic incentives are perceived as just or legitimate does not matter in these theories. Fairness-based altruism is, however, a powerful source of human cooperation. Here we show experimentally that the prevailing self-interest approach has serious shortcomings because it overlooks negative effects of sanctions on human altruism. Sanctions revealing selfish or greedy intentions destroy altruistic cooperation almost completely, whereas sanctions perceived as fair leave altruism intact. These findings challenge proximate and ultimate theories of human cooperation that neglect the distinction between fair and unfair sanctions, and they are probably relevant in all domains in which voluntary compliance matters--in relations between spouses, in the education of children, in business relations and organizations as well as in markets.