During his minority, Afonso V was placed under the regency of his mother in accordance with a will of his late father. As both a foreigner and a woman, the queen was not a popular choice for regent. Opposition rose and without any important ally among the Portuguese aristocracy other than Afonso, Count of Barcelos, the illegitimate half brother of King Edward, the queen's position was untenable. In 1439, the Portuguese Cortes (assembly of the kingdom) decided to replace the queen with Peter, Duke of Coimbra (Dom Pedro), the young king's oldest uncle.