穆拉比特王朝
In 1031, after the loss of Córdoba to the Almoravid dynasty, the king of Badajoz opted to transfer to Alfonso VI of León and Castile a few territories on the Iberian peninsula (among them Sintra) in order to gain an alliance with the Christian king. This transfer did not result in any security, and the castle was lost to the invading Almoravid.