A key challenge for evolutionary biologists is to determine conditions under which individuals benefit from a contribution to public goods [1, 2]. For humans, it has been observed that punishment of free riders may promote contributions [3, 4], but the conditions that lead to stable cooperation based on punishment remain hotly debated [5-8]. Here we present empirical evidence that public goods may emerge as a by-product of self-serving punishment in interactions between coral reef fishes and parasitic saber-tooth blennies that stealthily attack their fish victims from behind to take a bite [9]. We first show that chasing the blenny functions as punishment [10], because it decreases the probability of future attacks. We then provide evidence that in female scalefin anthias, a shoaling species, punishment creates a public good because it increases the probability that the parasite switches to another species for the next attack. A final experiment suggests that punishment is nevertheless self-serving because blennies appear to be able to discriminate between look-alike punishers and nonpunishers. Thus, individuals that do contribute to the public good may risk being identified by the parasite as easy targets for future attacks. Copyright © 2010 Elsevier Ltd. All rights reserved.