On 24 June 1128, the Battle of São Mamede occurred near Guimarães. Afonso Henriques, Count of Portugal, defeated his mother Countess Teresa and her lover Fernão Peres de Trava, thereby establishing himself as sole leader. Afonso then turned his arms against the Moors in the south.