This paper analyzes the historical determinants and long-term persistence of social capital, as well as its effect on economic development, by looking at the legacy of the commons in a Spanish region. In medieval times, common goods were granted to townships and were managed collectively by local citizens. This enabled the establishment of institutions for collective action and self-government. Common goods persisted until the second half of the nineteenth century. We argue that the experience of cooperation among villagers, repeated over the centuries, increased the social capital in each local community. In 1845, a law forced small villages to merge with others, a fact which generated exogenous variation in the number of mergers (i.e., cooperative networks) that each modern municipality was required to have. We exploit this change in an IV and RD setting and find that current municipalities formed by a greater number of old townships have a denser network of associations. We also find that higher social capital is associated with more economic development.