Whereas altruism drives the evolution of human cooperation, ethno- religious diversity has been considered to obstruct it, leading to poverty, corruption, and war. We argue that current research has failed to properly account for the institutional environment and how it affects the role diversity plays. The emergence of thriving, diverse communities throughout human history suggests that diversity does not always lead to cooperation breakdown. We conducted experiments in Mostar, Bosnia- Herzegovina with Catholic Croats and Muslim Bosniaks at a critical historic moment in the city’s postwar history. Using a public goods game, we found that the ability to sanction is key to achieving cooperation in ethno-religiously diverse groups, but that sanctions succeed only in integrated institutional environments and fail in segregated ones. Hence, we show experimentally for the first time in a real-life setting that institutions of integration can unleash human altruism and restore cooperation in the presence of diversity.