Alfonso XI, called the Avenger, was the king of Castile, León and Galicia. He was the son of Ferdinand IV of Castile and his wife Constance of Portugal. Upon his father's death in 1312, several disputes ensued over who would hold regency, which were resolved in 1313. Once Alfonso was declared adult in 1325, he began a reign that would serve to strengthen royal power. His achievements include the victory in the Battle of Río Salado over Granadans and Marinids and the Castilian control over the Strait of Gibraltar.
His effective reign began in August 1325 when he was sworn in as King as he was proclaimed to have reached the age of majority in the Cortes of Valladolid. Following a ritual that took him to Santiago de Compostela and to the monastery of Las Huelgas in Burgos, his self-crowning took place in 1332. As soon as he took the throne, he began working hard to strengthen royal power by dividing his enemies. His early display of ruthless rulership skills included the unhesitant execution of possible opponents. Alfonso XI ordered the assassination of his uncle Juan the One-eyed in Toro in the 1326 eve of the feast of All Saints, along with two of the latter's knights, luring the former with promises of reconciliation. He managed to extend the limits of his kingdom to the Strait of Gibraltar after the important victory at the Battle of Río Salado against the Marinid Dynasty in 1340 and the conquest of the Kingdom of Algeciras in 1344. Once that conflict was resolved, he redirected all his Reconquista efforts to fighting the Moorish king of Granada. During his reign a political reform in the municipal government took place, with the substitution of the concejos abiertos by the regimientos. He fostered the issuance of cartas pueblas as strategy for the demographic strengthening in the borderland areas. He is variously known among Castilian kings as the Avenger or the Implacable, and as "He of Río Salado." The first two names he earned by the ferocity with which he repressed the disorders caused by the nobles during his long minority; the third by his victory in the Battle of Río Salado over the last formidable Marinid invasion of the Iberian Peninsula in 1340. Alfonso XI never went to the insane lengths of his son Peter of Castile, but he could be bloody in his methods. He killed for reasons of state without any form of trial. He openly neglected his wife, Maria of Portugal, and indulged a scandalous passion for Eleanor of Guzman, who bore him ten children. Infected by the Black Death during the 1349–1350 siege of Gibraltar, Alfonso died in the night of 25–26 March 1350. The Castilian forces withdrew from Gibraltar, with some of the defenders coming out to watch. Out of respect, Yusuf ordered his army and his commanders in the border regions not to attack the Castilian procession as it traveled with the King's body to Seville.