History of Portugal (1834–1910)
Militant Republicans and their allies in the Carbonária were not willing to remain in the shadows of the constitutional monarchy. Between 4–5 October 1910, members of the Carbonária, republican youth, and elements of the army instigated a coup d'état against the already weak constitutional monarchy. The young king and his family, after a few miscues, escaped from the Palace in Mafra to exile in England. On the morning of 5 October 1910, the Republic was declared from the balcony of Lisbon City Hall, ending eight centuries of monarchy in Portugal.
Spanish Empire
In 1640, Spain had already experienced the loss of Portugal, following its revolt against Spanish rule, and brought to an end the Iberian Union, and the establishment of the House of Braganzaunder king John IV of Portugal. He had received widespread support from the Portuguese people, and Spain was unable to respond, since it was at war with France and Catalonia revolted that year. with the war against France. Spain and Portugal co-existed in a "de facto" state of peace from 1644 to 1656. When John died in 1656, the Spanish attempted to wrest Portugal from his son Alfonso VI of Portugal but were defeated at Ameixial (1663) and Montes Claros (1665), leading to Spain's recognition of Portugal's independence in 1668, during the regency of Philip IV's young heir, Charles II, who was seven at the time.