Afonso VI, known as "the Victorious", was the second King of Portugal of the House of Braganza from 1656 until his death. He was initially under the regency of his mother, Luisa of Medina-Sidonia, until 1662, when he removed her to a convent and took power with the help of his favourite, the Count of Castelo Melhor.
Afonso's reign saw the end of the Restoration War and Spain's recognition of Portugal's independence. He also negotiated a French alliance through his marriage. However, the king was physically and mentally weak. In 1668, his brother Pedro conspired to have him declared incapable of ruling, and took supreme de facto power as regent, although nominally Afonso was still sovereign. Queen Marie Françoise, Afonso's wife, received an annulment and subsequently married Pedro. Afonso spent the rest of his life and reign practically a prisoner.