Matilda II
Afonso's first wife was Matilda II, Countess of Boulogne, daughter of Renaud, Count of Dammartin, and Ida, Countess of Boulogne. They had no surviving children. He divorced Matilda in 1253 and, in the same year, married Beatrice of Castile, illegitimate daughter of Alfonso X, King of Castile, and Mayor Guillén de Guzmán.