He founded and granted privileges to the Mesta, a guild of migratory shephe
He founded and granted privileges to the Mesta, a guild of migratory shepherds.  Attacked by Morocco, Granada, and Murcia, with the Aragonese he defeated the invaders and annexed Murcia.  A claimant to the title of Holy Roman Emperor, after the death of Richard of Cornwall, Pope Gregory X convinced him to renounce his claim.  Conflicts with his son Sancho led to an uprising of nobles and forced him to flee to Seville.  For 10 points, name this Spanish king whose educated court produced the history Premera cronica general, the astronomical Tablas Alfonsies, and the law code Siete partidas.
He founded and granted privileges to the Mesta, a guild of migratory shepherds.  
Alfonso X or Alfonso the Wise or Alfonso the Learned