Following the Christian Reconquista of the peninsula, the village was conquered by Ordoño II of Galicia in 910. It was then reconquered in 997, by the forces of Almansor and caliphate of Cordoba, and would remain their possession until the 11th century. On 29 November 1057, the city was conquered from the Moors by Ferdinand I of León. Sometime in the 12 century, the tower keep and dungeons were constructed, followed in the 13th century by the fortification walls. The territory and its castle were given away in the dowry during the marriage of Henry of Burgundy and Teresa of Leon, and integrated into the lands of Portucalense (the County of Portugal). With its independence, they were donated to the Mendes (the Masters of Bragança) who initiated a series of construction projects in the 12th century, such as the keep tower, dungeons, the walls and cistern erected by Moors in the 11th century.
During the reign of King D. Sancho II (1223–1248), Abril Peres de Lumiares was alcalde was until 1245. It is believed that after the 1258 Inquirições (Inquiries), during the reign of King D. Afonso III (1248–1279), that the elaborate walls were erected.
Between the 14th and 15th centuries the town expanded, owing to manufacture of textiles and a regally-mandated annual regional fair. During this period the alcaldes of the castle were the Coutinhos, that included Gonçalo Vasques Coutinho, then also alcalde of the Castle of Trancoso, who during the 1383-1385 crisis, supported the Portuguese pretender, the Master of Aviz. At the end of this period, D. Francisco Coutinho, 4th Count of Marialva ordered the construction a window in the middle of the keep tower.