In 1167, the Castle and medina was taken by Geraldo Sem Pavor, in an expedition that came from Évora (which had just been retaken, about the same time). After, Afonso Henriques' defeat in Badajoz, Monsaraz was once again taken by Muslim forces. In 1232, supported by the Knights Templar, King Sancho II definitively retook the citadel and town, placing it under the control of the Templars, and obligating them to establish a garrison that would protect the border. The Christian repopulation of Monsaraz ended around the reign of Afonso III, when it was assigned an alcalde, the knight Martim Anes, and first letter of foral.