Afonso's grandfather Afonso V of Portugal had sided with Joanna la Beltraneja who was a rival for the throne of Castile against her half-aunt, Queen Isabella I of Castile. She was never considered legitimate and, when the king was dying, no one took her as a serious contender for the crown. Isabella was due to inherit the crown, but Afonso V was keen to interfere with the succession in Castile. In 1475 he married his niece Joanna, whom he considered the legitimate heir to the crown. Since her adulteress mother was his own sister, Afonso V had not only ambition, but the family honour to protect. He proclaimed himself King of Castile and León and prepared to defend his wife's rights.