Aracena, Aroche, Moura and Serpa were important towns in Gharb al-Ándalus, the western part of the Andalusian territory. The mesnadas of the order of the Hospital de San Juan, commanded by Alfonso Pérez Fariñas, conquered these populations between 1230 and 1250 and gave them to King Alfonso III of Portugal, giving rise to the conflict in the Algarve since they were also claimed by the kingdom of Castile. and Leon. With the signing of the Badajoz treaty in 1267, these populations were integrated into the kingdom of Alfonso X "El Sabio". Later, in 1297, with the treaty of Alcañices, Aroche and Aracena came to belong to Castilla y León as a royal land and integrated into the Council of Seville and while Serpa and Moura depended on Portugal.