King Ferdinand and Isabella, however, won the war of succession and, as part of the Treaty of Alcáçovas, signed in 1479, it was agreed that their eldest daughter Isabella would marry Afonso. Isabella was also to come with a very large dowry that in practice represented the war compensation obtained by Portugal. In 1480, Prince Afonso, who at that time was five years old, went to live in the town of Moura with his maternal grandmother, Beatrice. In the early months of the following year, his future wife, the ten-year-old Isabella, joined him and lived there for about two years.