From his birth to 1204 Ferdinand was designated heir to his father's kingdom of Leon with the support of his mother and the kingdom of Castile despite the fact that he was Alfonso IX's second son. Alfonso IX already had a son and two daughters from his first, dissolved marriage to Teresa of Portugal but at the time he never acknowledged his first son (also named Ferdinand) as his heir. However, the Castilians saw the elder Ferdinand as a potential rival and threat to Berengaria's son.