Alfonso IX had great difficulty in obtaining the throne through his given birthright. In July 1188 his cousin Alfonso VIII of Castile required the younger Alfonso to recognize the elder as overlord in exchange for recognizing the younger's authority in León.
The convening of the Cortes de León in the cloisters of the Basilica of San Isidoro would be one of the most important events of Alfonso's reign. The difficult economic situation at the beginning of his reign compelled Alfonso to raise taxes on the underprivileged classes, leading to protests and a few towns revolts. In response the king summoned the Cortes, an assembly of nobles, clergy and representatives of cities, and subsequently faced demands for compensatory spending and greater external control and oversight of royal expenditures. Alfonso's convening of the Cortes is considered by many historians, including Australia's John Keane, to be instrumental to the formation of democratic parliaments across Europe. Note that Iceland had already held what may have been what is Europe's first parliament, the Þingvellir, in 930 CE. However, the Cortes' 1188 session predates the first session of the Parliament of England, which occurred in the thirteenth century.
In spite of the democratic precedent represented by the Cortes and the founding of the University of Salamanca, Alfonso is often chiefly remembered for the difficulties his successive marriages caused between him with Pope Celestine III. He was first married in 1191 to his first cousin, Theresa of Portugal, who bore him two daughters, and a son who died young. The marriage was declared null by the papal legate Cardinal Gregory for consanguinity.
After Alfonso VIII of Castile was defeated at the Battle of Alarcos, Alfonso IX invaded Castile with the aid of Muslim troops. He was summarily excommunicated by Pope Celestine III. In 1197, Alfonso IX married his first cousin once removed, Berengaria of Castile, to cement peace between León and Castile. For this second act of consanguinity, the king and the kingdom were placed under interdict by representatives of the Pope. In 1198, Pope Innocent III declared Alfonso and Berengaria's marriage invalid, but they stayed together until 1204. The annulment of this marriage by the pope drove the younger Alfonso to again attack his cousin in 1204, but treaties made in 1205, 1207, and 1209 each forced him to concede further territories and rights. The treaty in 1207 is the first existing public document in the Castilian dialect.
The Pope was, however, compelled to modify his measures by the threat that, if the people could not obtain the services of religion, they would not support the clergy, and that heresy would spread. The king was left under interdict personally, but to that he showed himself indifferent, and he had the support of his clergy.
In 1211 Alfonso IX of León gave the castle of Alcañices to the Templar Order, where inhabitants celebrated the great victories of the order.