Abstract
We study how affluent societies restrict immigration to protect their wealth through a model and historical evidence. We show how institutional change emerges locally, spreads by contagion, and generates a situation where societies are locked into a closed system. Only a centralized intervention could restore an open system. We follow the institutional trajectory of hundreds of communities in Italy for six centuries (1200-1800), where the closure took the form of patrilineal vs. egalitarian membership in a society. We uncover the mechanisms of the gradual transition from an open to a closed system and the abrupt re-establishment of an open system.