 In the 13th century, it was conquered by San Fernando, who rebuilt it.Nevertheless, at the beginning of the XIV century, it returned to Muslim hands, being definitively reconquered by Alfonso XI in 1341.However, being located in the middle of the Moorish Border or Band was besieged by the Muslims of Granada in 1408 and in 1445.