In 1383, John I of Castile, husband of Beatrice of Portugal and son-in-law of Ferdinand I of Portugal, claimed the throne of Portugal. A faction of petty noblemen and commoners, led by John of Aviz (later King John I of Portugal) and commanded by General Nuno Álvares Pereira defeated the Castilians in the Battle of Aljubarrota. With this battle, the House of Aviz became the ruling house of Portugal.