As the son of Alfonso IX of León and his second wife Berengaria of Castile, Ferdinand descended from Alfonso VII of Leon and Castile on both sides; his paternal grandfather Ferdinand II of Leon and maternal great grandfather Sancho III of Castile were the sons of Alfonso VII between whom his kingdom was divided. Ferdinand had other royal ancestors from his paternal grandmother Urraca of Portugal and his maternal grandmother Eleanor of England a daughter of Henry II of England and Eleanor of Aquitaine.