emplacements. By the Restoration, the Spanish commander, Álvaro de Viveiros, resisted for eleven months (from 27 March 1641 to 4 March 1642) behind the walls of the impregnable fortress, and only a concentrated task force commanded by Francisco Ornelas da Câmara and João de Bettencourt were able to defeat the commander. The fort was taken, and reclaimed for Portugal: a church was constructed within the fortress in honour of Saint John the Baptist () after 1642. 17th century Over the years, Terceira (and Angra in particular) has been a popular place for out-of-favor monarchs to cool their heels while events on the Portuguese mainland or elsewhere went on without them. In 1667, near the end of the Portuguese Restoration War, King Afonso VI, his chief advisor, Castelo Melhor, and Castelo Melhor's francophile party were overthrown by the king's younger brother, Pedro, Duke of Beja, (who later ruled as Pedro II of Portugal.) Pedro first installed himself as his brother's regent; then, he arranged Afonso's exile to the island of Terceira in the Azores on the pretense that he was incapable of governing. Afonso's exile lasted seven years. João Baptista da Silva Leitão de Almeida Garrett, better known as the author Almeida Garrett, was born in 1799 in Porto, Portugal. In 1809, his family fled the second French invasion carried out by Soult's troops, seeking refuge in Angra do Heroísmo. While in the Azores, he was taught by his uncles, all prominent churchmen. (His uncle, Dom Frei Alexandre da Sagrada Família, was the twenty-fifth bishop of Angra.) In 1818, Almeida Garrett left the island and moved to Coimbra to study at the university's law school. 19th century When King João VI died in 1826, the country was plunged into a succession crisis. The king had a rightful male heir, Emperor Pedro of Brazil, who had successfully rebelled against his father in the 1820s. Many prominent Portuguese, however, did not wish to be reunified with their former colony. The king's younger son Miguel was exiled in Austria, having led a number of failed revolutions of his own against his father's liberal regime. Pedro abdicated the Portuguese throne in favor of his 7-year-old daughter Maria da Glória, stipulating that she would marry her uncle Miguel when she came of age. In order to rule jointly with his niece, however, Miguel was obligated to swear an oath to uphold the existing liberal constitution. Miguel