Alfons X, Alphonse X or Alfonso X, called the Wise, was the King of Castile, León and Galicia from 30 May 1252 until his death. During the Imperial election of 1257, a dissident faction chose him to be King of the Romans on 1 April. He renounced his imperial claim in 1275, and in creating an alliance with England in 1254 his claim on Gascony also.
Alfonso established Castilian as a language of higher learning, and was a prolific author of Galician poetry, such as the Cantigas de Santa Maria, which are equally notable for their musical notation as for their literary merit. Alfonso's scientific interests—he is sometimes nicknamed "the Astrologer" —led him to sponsor the creation of the Alfonsine tables, and the Alphonsus crater on the moon is named after him. As a legislator he introduced the first vernacular law code in Spain, the Siete Partidas. He created the Mesta, an association of sheep farmers in the central plain, but debased the coinage to finance his claim to the German crown. He fought a successful war with Portugal, but a less successful one with Granada. The end of his reign was marred by a civil war with his eldest surviving son, the future Sancho IV, which would continue after his death.