King John IV's eldest son came to reign as Afonso VI, however his physical and mental disabilities left him overpowered by Luís de Vasconcelos e Sousa, 3rd Count of Castelo Melhor. In a palace coup organized by the King's wife, Maria Francisca of Savoy, and his brother, Pedro, Duke of Beja, King Afonso VI was declared mentally incompetent and exiled first to the Azores and then to the Royal Palace of Sintra, outside Lisbon. After Afonso's death, Pedro came to the throne as King Pedro II. Pedro's reign saw the consolidation of national independence, imperial expansion, and investment in domestic production.