Between the 5th and 11th century was occupied by Visigoths and Arabs.
In order to build a defensive line and strengthen his presence in the region, D. Afonso I of Portugal donated the area to D. Gualdim Pais, Master of the Templars; a vast region, that extended to the territory of Egitânea (corresponding to Idanha-a-Velha) along the Rio Erges.
"Afonso, remarkable king of the Portuguese" (Portugalensium rex)", son of Henry and Queen D. Teresa and grandson of the great and illustrious Emperor of Hispania, for us to master Galdino and all the brothers of the Knights Templar who are in my kingdom, I make a wide and giving very strong in the region of Idanha [-a-Velha] and Monsanto with the limits: Following the course of the river and between Erges my kingdom and the 'legions' to enter the [river] Tagus and the other party following the course of water [river] Zêzere River which also enters the river Tagus (...). " (Letter of Donation on 30 November 1165.)
The castles of Monsanto and Idanha-a-Velha were constructed by 1171, when a foral (charter) was donated to the settlement, following the model of Ávila/Évora. During the course of litigation with the Order of the Temple in 1172, the castle was donated to the Order of Santiago ("facio cartam donationis de castello meo proprio quad dicitur Mons Sanctus"), with the condition of not nominating an unknown commander. As a result of this change, in 1174, a new foral was issued to the inhabitants of Monsanto, by D. Afonso Henriques, which was confirmed in 1190 by D. Sancho I.
A contemporary castle was constructed during the 13th century.
It was reconstructed in the 14th century, during the reigns of King D. Dinis and D. Fernando.
But, following its alignment with the Kingdom of Castile during the 1383–1385 Portuguese interregnum, the site began to fall into disorder. According to the chronicler Fernão Lopes, Monsanto was a village that had been loyal to Queen Beatrice. But, later however, Lopes listed the town among those aligned themselves with D. John by 1384.