With the establishment of the Christian kingdom of Portugal, Afonso Henriques donated portions of the land for charitable hospices (Salto), hospitals (Vilar de Perdizes and Dornelas) or monasteries (Pitões). Owing to its location, on the border with Galiza, defense fortifications were constructed, including the Castles of Gerês and Piconha, and later in Portelo and the village of Montalegre. A lighthouse was also constructed in Tourém, likely by King Sancho in 1187, since he was the master of the Terras da Piconha region.