Every ruler desires an heir, and therefore needs a spouse. Alfonso found his in 1191 in Theresa of Portugal. Theresa was 15 at the time, daughter of the king of Portugal, Sancho I. They had three children: Sancha, Dulce, and Ferdinand. Elsewhere I have mentioned how, in 1224, Alfonso tried to marry Sancha to John of Brienne. John chose a younger daughter by a later wife of Alfonso, but it might not have been just Sancha's age that disqualified her in John's eyes (he was, after all, a good many years older).
In fact, Sancha's "status" might have been a problem for John. Theresa of Portugal was Alfonso's cousin, and Pope Celestine III condemned the marriage on the grounds of consanguinity. Celestine had his papal legate declare the marriage nullified, placing both León and Portugal under Interdict. John might have avoided the match because Sancha could be considered illegitimate and therefore not eligible to inherit León.
Only a year later, Celestine excommunicated Alfonso for "consorting with the enemy." Alfonso clashed with his cousin, Alfonso VIII of Castile. Prior wars had seen territorial boundaries shifting, and León wanted some of their land back. Alfonso invaded Castile with the aid of Muslims, which was a strong offense in Celestine's eyes. (Alfonso VIII had proven an enemy to Muslims, mentioned here.) To create peace between Castile and León, they did what many warring nations did at the time: arranged a marriage between representatives of the two. In this case, the marriage was between Alfonso IX and Berengaria of Castile in 1197.
The problem was that Berengaria was Alfonso VIII's daughter, and therefore her husband's first cousin once removed. (Her paternal grandfather and Alfonso's father were brothers.) León was placed under Interdict once again due to consanguinity. In 1198, Pope Innocent III declared this second marriage annulled, but the couple decided to stay together until 1204, when Alfonso decided he should attack Castile again. (A series of treaties ultimately resolved the borders and the hostilities.)
As for the Interdiction, the pope realized that, if the people went years without the benefits of the mass and sacraments, they would have no reason to support the church financially. He lifted the Interdict on the country, but kept it on the king.
Another strike against Alfonso (but helped make him historically memorable) was his numerous affairs and subsequent numerous illegitimate children. That family tree had many branches, which I'll lay out tomorrow.