Meanwhile the Reconquest languished in Castile; at first, because of the candidacy of Alfonso X for the crown of the Holy Roman Empire, in which candidacy he had secured a majority of the electoral princes. This was followed by a disputed succession to the throne, the rival claimants being the Cerda heirs (sons of Fernando, the eldest son of Alfonso X) and the second son of Sancho IV. Next came the minorities of Ferdinand IV, Alfonso XI, Henry III, and John II, and fresh civil strife in the reigns of Pedro the Cruel and of Henry IV. Ferdinand IV succeeded to the throne at the age of nine, being under the tutelage of his mother María de Molina. Alfonso XI was little more than one year old when his father died (1312); and though his reign was in many respects glorious, and he overcame the Marinids in the Battle of Río Salado (1340), still his amours with Eleanor de Guzmán, by whom he had several children, resulted in the wars of the following reign, that of Pedro the Cruel, who was at last slain by his bastard brother, Henry of Trastámara, and succeeded on the throne by him under the title of Henry II. John I, who married Beatrice of Portugal (1383), sought to unite the two kingdoms on the death of Ferdinand, the last King of Portugal of the Burgundian line. The Portuguese, however, defeated John of Castile at the Battle of Aljubarrota, and the Portuguese Crown went to the Master of Aviz, who became John I of Portugal (1385). Henry III, who married Catherine of Lancaster, was the first to take the title of Prince of Asturias as heir to the Crown, which he inherited during his minority, as did his son, John II.