Humans often 'altruistically' punish non-cooperators in one-shot interactions among genetically unrelated individuals. This poses an evolutionary puzzle because altruistic punishment enforces cooperation norms that benefit the whole group but is costly for the punisher. One key explanation is that punishment follows a social-benefits logic: it is eminently normative and group-functional (drawing on cultural group selection theories). In contrast, mismatch-based deterrence theory argues that punishment serves the individual-level function of deterring mistreatment of oneself and one's allies, hinging upon the evolved human coalitional psychology. We conducted multilateral-cooperation experiments with a sample of Spanish Romani people (Gitanos or Calé) and the non-Gitano majority. The Gitanos represent a unique case study because they rely heavily on close kin-based networks and display a strong ethnic identity. We find that Gitano non-cooperators were not punished by co-ethnics in only-Gitano (ethnically) homogeneous groups but were harshly punished by other Gitanos and by non-Gitanos in ethnically mixed groups. Our findings suggest the existence of culture-specific motives for punishment: Gitanos, especially males, appear to use punishment to protect their ethnic identity, whereas non-Gitanos use punishment to protect a norm of universal cooperation. Only theories that consider normative, group-functional forces underlying punishment behaviour can explain our data.