This paper investigates the potential of frontiers to shape the economic geography of countries. I focus on the case of Spain to explore how historical frontier warfare can condition the colonization of the territory in such a way to make it one of the most desert areas in Europe. First, I document that Spain stands out in Europe with a very low density of settlements and a very high spatial concentration of the population, which are not explained by geographic and climatic factors. Second, I exploit a spatial discontinuity in military insecurity during the Christian colonization of central Spain in the Middle Ages to investigate the historical roots of this phenomenon. The findings suggest that medieval frontier warfare heavily conditioned the colonization of the territory, resulting in a very sparse occupation of the space, a high degree of militarization, and a ranching orientation of the economy. These initial features of the colonization process led to a remarkably low level of settlement density and high spatial concentration of the population that have persisted to this day, with potential negative consequences for economic development.