Cooperation is ubiquitous in the natural world. What seems nonsensical is why natural selection favors a behavior whereby individuals would lose out by benefiting their competitor. This conundrum, for almost half a century, has puzzled scientists and remains a fundamental problem in biology, psychology, and economics. In recent years, the explanation that punishment can maintain cooperation has received much attention. Individuals who punish noncooperators thrive when punishment does not entail a cost to the punisher. However when punishment is costly, cooperation cannot be preserved. Most literature on punishment fails to consider that punishers may act corruptly by not cooperating when punishing noncooperators. No research has considered that there might be power asymmetries between punishers and nonpunishers that turn one of these type of individuals more or less susceptible to experiencing punishment. Here, we formulate a general game allowing corruption and power asymmetries between punishers and nonpunishers. We show that cooperation can persist if punishers possess power and use it to act corruptly. This result provides a new interpretation of recent data on corrupt policing in social insects and the psychology of power and hypocrisy in humans. These results suggest that corruption may play an important role in maintaining cooperation in insects and human societies. In contrast with previous research, we contend that costly punishment can be beneficial for social groups. This work allows us to identify ways in which corruption can be used to the advantage of a society.