Alfonso X as a judge, from his Libro de los Dados
completed ca. 1280.
Born in Toledo, Kingdom of Castile, Alfonso was the eldest son of Ferdinand III of Castile and Elizabeth (Beatrice) of Swabia. His mother was the paternal cousin of Holy Roman Emperor Frederick II, to whom Alfonso is often compared. His maternal grandparents were Philip of Swabia and Irene Angelina. Little is known about his upbringing, but he was most likely raised in Toledo. For the first nine years of his life Alfonso was only heir to Castile until his paternal grandfather king Alfonso IX of Leon died and his father united the kingdoms of Castile and Leon. He began his career as a soldier, under the command of his father, when he was only sixteen years old.
After the election of Theobald I as king of Navarre, his father tried to arrange a marriage for Alfonso with Theobald's daughter, Blanche of Navarre, but the move was unsuccessful. At the same time, he had a romantic relationship with Mayor Guillén de Guzmán, who bore him a daughter, Beatrice. In 1240, he married Mayor Guillén de Guzmán, but the marriage was later annulled and their issue declared illegitimate. In the same period (1240–1250) he conquered several Muslim strongholds in Al-Andalus alongside his father, such as Murcia, Alicante and Cadiz.
In 1249, Alfonso married Violante of Aragon, the daughter of King James I of Aragon and Yolande of Hungary, although betrothed already in 1246.
Alfonso succeeded his father as King of Castile and León in 1252. The following year he invaded Portugal, capturing the region of the Algarve. King Afonso III of Portugal had to surrender, but he gained an agreement by which, after he consented to marry Alfonso X's daughter Beatrice of Castile, the land would be returned to their heirs. In 1261 he captured Jerez. In 1263 he returned Algarve to the King of Portugal and signed the Treaty of Badajoz (1267).
In 1254 Alfonso X signed a treaty of alliance with the King of England and Duke of Aquitaine, Henry III, supporting him in the war against Louis IX of France. In the same year Alfonso's half sister, Eleanor of Castile, married Henry's heir to the throne, Edward: with this act Alfonso renounced forever all claim to the Duchy of Gascony, to which Castile had been a pretender since the marriage of Alfonso VIII of Castile with Eleanor of England.
In 1256, at the death of William II of Holland, Alfonso's descent from the Hohenstaufen through his mother, a daughter of the emperor Philip of Swabia, gave him a claim through the Swabian line. Alfonso's election as King of the Romans by the imperial prince-electors misled him into complicated schemes that involved excessive expense but never succeeded. Alfonso never even traveled to Germany, and his alliance with the Italian Ghibelline lord Ezzelino IV da Romano deprived him of the initial support of Pope Alexander IV. His rival, Richard of Cornwall, went to Germany and was crowned in 1257 at Aachen.
To obtain money, Alfonso debased the coinage and then endeavored to prevent a rise in prices by an arbitrary tariff. The little trade of his dominions was ruined, and the burghers and peasants were deeply offended. His nobles, whom he tried to cow by sporadic acts of violence, rebelled against him in 1272. Reconciliation was bought by Alfonso's son Ferdinand in 1273.
In the end, after Richard's death, the German princes elected Rudolph I of Habsburg (1273), Alfonso being declared deposed by Pope Gregory X. In 1275 Alfonso tried to meet with his imperial vicar in Italy, William VII of Montferrat (who had succeeded Ezzelino) and his Ghibelline allies in Piedmont and Lombardy to celebrate the victory against the Guelph Charles I of Anjou and be crowned in Lombardy; he was however halted in his imperial ambitions in Provence by the Pope who, after a long negotiation, obtained Alfonso's oral renunciation of the title of King of the Romans.
Throughout his reign, Alfonso contended with the nobles, particularly the families of Nuño González de Lara, Diego López de Haro and Esteban Fernández de Castro, all of whom were formidable soldiers and instrumental in maintaining Castile's military strength in frontier territories. According to some scholars, Alfonso lacked the singleness of purpose required by a ruler who would devote himself to organization, and also the combination of firmness with temper needed for dealing with his nobles. Others have argued that his efforts were too singularly focused on the diplomatic and financial arrangements surrounding his bid to become Holy Roman Emperor.
Alfonso's eldest son, Ferdinand, died in 1275 at the Battle of Écija against the Moroccan and Granadan invasion armies, leaving two infant sons. Alfonso's second son, Sancho, claimed to be the new heir, in preference to the children of Ferdinand de la Cerda, basing his claim on an old Castilian custom, that of proximity of blood and agnatic seniority. Alfonso preferred to leave the throne to his grandsons, but Sancho had the support of the nobility. A bitter civil war broke out resulting in Alfonso's being forced in 1282 to accept Sancho as his heir instead of his young grandsons; only the cities of Seville, Murcia and Badajoz remained faithful to him. Son and nobles alike supported the Moors when he tried to unite the nation in a crusade; and when he allied himself with Abu Yusuf Yakub, the ruling Marinid Sultan of Morocco, they denounced him as an enemy of the faith. A reaction in his favor was beginning in his later days, but he died defeated and deserted at Seville in 1284, leaving a will, by which he endeavored to exclude Sancho, and a heritage of civil war.
In 1273, he created the Mesta, an association of some 3,000 petty and great sheep holders in Castile, in reaction to less wool being exported from the traditional sites in England. This organization later became exceedingly powerful in the country (as wool became Castile's first major exportable commodity and reported a trade surplus, called "white gold", as the wool amount was critical to the health of the population during the winter), and eventually its privileges were to prove a deadly wound in the Castilian economy. One side effect of the quickly expanding sheep herds was the decimation to the Castilian farmland through which the sheep grazed.
The original function of the Mesta was to separate the fields from the sheep-ways linking grazing areas.
As a ruler, Alfonso showed legislative capacity, and a wish to provide the kingdoms expanded under his father with a code of laws and a consistent judicial system. The Fuero Real was undoubtedly his work. He began medieval Europe's most comprehensive code of law, the Siete Partidas, which, however, thwarted by the nobility of Castile, was only promulgated by his great-grandson. Because of this, and because the Partidas remain fundamental law in the American Southwest, he is one of the 23 lawmakers depicted in the House of Representatives chamber of the United States Capitol.
From a young age Alfonso X showed an interest in military life and chivalry. In 1231 Alfonso traveled with Pérez de Castron on a military campaign in lower Andalusia. Writing in Estoria de España, Alfonso describes having seen St. James on a white horse with a white banner and a legion of knights fighting a war above the soldiers of Spain. This vision of a heavenly army fighting in Jerez and participation in military campaigns likely left Alfonso X with a high degree of knowledge and respect for military operations and chivalric knights. Alfonso's respect for chivalry can also be seen in his writing of Spanish law. Spanish Chivalric conduct was codified in the Siete Partidas (2,21) where he wrote that knights should be, "of good linage and distinguished by gentility, wisdom, understanding, loyalty, courage, moderation, justice, prowess, and the practical knowledge necessary to assess the quality of horse and arms (Siete Partidas, 21,1-10)." These efforts to make a codified standard of chivalric conduct were likely meant to both encourage strength of arms (prowess) and to restrain the use of violence for only just (state-sponsored) usage.