Alfonso XI, 1311–50, Spanish king of Castile and León (1312–50), son and successor of Ferdinand IV. His vigorous campaign against Granada provoked an invasion by the Moors from Morocco; they took Gibraltar in 1333. In 1340, having formed alliances with Portugal, Navarre, and Aragón, Alfonso won the great victory of Tarifa (also called the battle of Salado), and in 1344 he took Algeciras. By the Ordenamiento de Alcalá, issued at Alcalá de Henares in 1348, Alfonso enforced the Siete Partidas of Alfonso X. He died while besieging Gibraltar and was succeeded by his son, Peter the Cruel.