Portuguese victory
 The Portuguese Restoration War (Portuguese: Guerra da Restauração) was the war between Portugal and Spain that began with the Portuguese revolution of 1640 and ended with the Treaty of Lisbon in 1668, bringing a formal end to the Iberian Union. The period from 1640 to 1668 was marked by periodic skirmishes between Portugal and Spain, as well as short episodes of more serious warfare, much of it occasioned by Spanish and Portuguese entanglements with non-Iberian powers. Spain was involved in the Thirty Years' War until 1648 and the Franco-Spanish War until 1659, while Portugal was involved in the Dutch–Portuguese War until 1663.
 In the seventeenth century and afterwards, this period of sporadic conflict was simply known, in Portugal and elsewhere, as the Acclamation War. The war established the House of Braganza as Portugal's new ruling dynasty, replacing the House of Habsburg who had been united with the Portuguese crown since the 1580 succession crisis.
 When Philip II of Portugal (Philip III of Spain) died, he was succeeded by his son Philip III of Portugal (Phillip IV of Spain) who followed a different approach to Portuguese concerns. Portuguese merchants saw higher taxes, the Portuguese nobility began to lose its influence at the Spanish Cortes, and Spaniards increasingly occupied the government's posts in Portugal.
 Ultimately, Philip III tried to make Portugal into a Spanish province, and Portuguese nobles stood to lose all of their power.[citation needed]
 Moreover, Spain entangled Portugal in the efforts to suppress the independence of the Dutch Republic during the Eighty Years' War. In response, the Dutch embarked on systematic attacks on Portuguese colonies and outposts, either pillaging or occupying them in what is known as the Dutch–Portuguese War. The Portuguese felt great resentment at what they perceived as Spain prioritizing the protection of its own colonies, while neglecting the defense of the Portuguese ones. 
 The situation culminated in a revolution organized by the nobility and bourgeoisie, executed on 1 December 1640, sixty years after the crowning of Philip I (Philip II of Spain), the first "dual monarch".
 The plot was planned by Antão Vaz de Almada, Miguel de Almeida and João Pinto Ribeiro. They, together with several associates, known as the Forty Conspirators, killed the Secretary of State, Miguel de Vasconcelos, and imprisoned the king's cousin, Margaret of Savoy, who had been governing Portugal in his name. Philip's troops were then fighting the Thirty Years' War and also facing a revolution in Catalonia, which became known as the Reapers' War.
 The support of the people became apparent almost immediately and within a matter of hours, Philip III's third cousin John, 8th Duke of Braganza, was acclaimed as King John IV of Portugal. The news spread quickly throughout the country. By 2 December 1640, the day after the coup, John IV, acting in his capacity as sovereign of the country, had sent a letter to the Municipal Chamber of Évora.
 The ensuing conflict with Spain brought Portugal into the Thirty Years' War as at least a peripheral player. From 1641 to 1668, the period during which the two nations were at war, Spain sought to isolate Portugal militarily and diplomatically, and Portugal tried to find the resources to maintain its independence through political alliances and maintaining its colonial income.
 Immediately after assuming the Portuguese throne, John IV took several steps to strengthen his position. On 11 December 1640, a 'Council of War' was created to organize all of the operations. Next, the king created the 'Junta of the Frontiers' to take care of the fortresses near the border, the hypothetical defense of Lisbon, and the garrisons and sea ports.
 A year later, in December 1641, he created a tenancy to assure that all of the country's fortresses would be upgraded and that the improvements would be financed with regional taxes. He also organized the army, re-established the 'Military Laws of King Sebastian', and undertook a diplomatic campaign focused on restoring good relations with England.
 After gaining several small victories, John tried to make peace quickly. However, his demand that Philip recognize the new ruling dynasty in Portugal was not fulfilled until the reign of his son, Afonso VI, during the regency of Peter of Braganza, another of his sons, who later became King Peter II of Portugal). Confrontations with Spain lasted 28 years.
 In 1640, Cardinal Richelieu, the chief adviser to Louis XIII of France was fully aware of the fact that France was operating under strained circumstances. Louis was at war with Spain at that time; he had to control rebellions within France that were supported and financed by Madrid and had to send French armies to fight the Spanish Habsburgs on three different fronts. In addition to their shared frontier at the Pyrenees, Philip IV of Spain, formerly Philip III of Portugal as well, reigned, under various titles, in Flanders and the Franche-Comté, to the north and east of France. In addition, Philip IV controlled large territories in Italy, where he could, at will, impose a fourth front by attacking French-controlled Savoy (In Savoy, Christine Marie of France was acting as regent on behalf of her young son, Charles Emmanuel II, Duke of Savoy).
 Spain had enjoyed the reputation of having the most formidable military force in Europe, with the introduction of the arquebus and the so-called "Spanish School", but that reputation and tactic had diminished with the Thirty Years' War. Nevertheless, the consummate statesman, Richelieu, decided to force Philip IV to look to his own internal problems. To divert the Spanish troops besieging France, Louis XIII, on the advice of Richelieu, supported John's claim during the Acclamation War on the reasoning that a Portuguese war would drain Spanish resources and manpower.
 To fulfill the common foreign policy interests of Portugal and France, a treaty of alliance between the two countries was concluded at Paris on 1 June 1641. It lasted eighteen years before Richelieu's successor as unofficial foreign minister, Cardinal Mazarin, broke the treaty and abandoned his Portuguese and Catalan allies to sign a separate peace with Madrid. The Treaty of the Pyrenees was signed in 1659. Under its terms, France received the portion of Catalonia north of the Pyrenees, known as the Roussillon, and part of the Cerdanya (French Cerdagne). Most important to the Portuguese, the French recognised Philip IV of Spain as the legitimate king of Portugal.
 Seven years later, in the late stages of the Portuguese Restoration War, relations between the two countries thawed to the extent that the young (but sickly) Afonso VI of Portugal married a French princess, Marie Françoise of Nemours.
 At the time of the revolution in Lisbon (1 December 1640), the Portuguese had been at war with the Dutch for nearly forty years. A good deal of the conflict can be attributed to the fact that Spain and the Dutch Republic were concurrently engaged in the Eighty Years' War (1568–1648), and, ever since hostilities between Portugal and the Dutch Republic erupted in 1602, Portugal had been ruled by a Spanish monarch.
 The Dutch-Portuguese War was fought almost entirely overseas, with the Dutch mercantile surrogates, the Dutch East India Company and the Dutch West India Company, repeatedly attacking Portugal's colonial possessions in the Americas, in Africa, in India, and in the Far East. Portugal was in a defensive posture throughout, and it received very little military help from Spain.
 After the acclamation of John, the pattern persisted all over the Portuguese Empire until the final expulsion of the Dutch from Angola (1648), São Tomé (1649), and Brazil (1654). The Dutch signed a European truce with Portugal, helping each other somewhat against their common enemy, Spain. The Dutch resumed buying salt in the Setúbal salt factories, restarting commerce between the two countries for the first time since 1580, when the Spanish branch of the Habsburgs, against whom the Dutch were in revolt, had assumed the Portuguese throne. However, Dutch attacks on Portuguese territories persisted until 1663, even after the signing of the Treaty of The Hague in 1661.
 England was then embroiled in its own civil war. Portuguese problems in dealing with England arose from the fact that the English Parliament fought and won its anti-royalist war while, at the same time, Portugal's royal court continued to receive and recognize English princes and nobles. The strained relations persisted during the short-lived Commonwealth period, when the republican government that had deposed Charles I ruled England and then Ireland and Scotland.
 After the restoration of the Stuart dynasty, it became possible for Portugal to compensate for the lack of French support by renewing its alliance with England, with experienced soldiers and officers available from the demobilised New Model Army. That took the form of a dynastic marriage between Charles II and Afonso VI's sister, Catherine of Braganza, which assured Portugal of outside support in its conflict with Spain. The English alliance helped peace with Spain, which had been drained by the Thirty Years' War and had no stomach for further warfare with other European powers, especially a resurgent England.
 Militarily, the Portuguese Restoration War consisted mainly of border skirmishes and cavalry raids to sack border towns, combined with occasional invasions and counter-invasions, many of them half-hearted and under-financed. There were only five major set-piece battles during twenty-eight years of hostilities.
 The war may be considered to have had three periods:
 Hoping for a quick victory in Portugal, Spain immediately committed seven regiments to the Portuguese frontier, but delays by the Count of Monterrey, a commander with more interest in the comforts of life at camp than the battlefield, squandered any immediate advantage. A Portuguese counter-thrust in late 1641 failed, and the conflict soon settled into a stalemate.
 On 26 May 1644, a large column of Spanish troops and mercenaries, commanded by Neapolitan marquis of Torrecusa, was stopped at the Battle of Montijo by the Portuguese, who were led by the Matias de Albuquerque, one of a number of experienced Portuguese colonial officers who rose to prominence during the war.
 The war now took on a peculiar character. It became a frontier confrontation, often between local forces, neighbours who knew each other well, but this familiarity did not moderate the destructive and blood-thirsty impulses of either side. The wanton nature of the combat was often exacerbated by the use of mercenaries and foreign conscripts; incidents of singular cruelty were reported on both sides. The Portuguese settled old animosities that had festered during sixty years of Spanish domination, and the Spanish often took the view that their opponents were disloyal and rebellious subjects, not an opposing army entitled to respectful treatment under the rules of combat.
 Three theaters of warfare were eventually opened, but most activity focused on the northern front, near Galicia, and on the central frontier between Portuguese Alentejo and Spanish Extremadura. The southern front, where the Portuguese Algarve abuts Spanish Andalusia, was a logical target for Portugal, but it was never the focus of a Portuguese attack, probably because the Portuguese queen, Luisa de Guzmán, was the sister of the Duke of Medina Sidonia, the leading noble of Andalusia.
 Spain, at first, made the war a defensive one. Portugal, for its part, felt no need to take Spanish territory in order to win, and it too was willing to make the war a defensive contest. Campaigns typically consisted of correrias (cavalry raids) to burn fields, sack towns, and steal large herds of enemy cattle and sheep. Soldiers and officers, many of them mercenaries, were primarily interested in booty and prone to desertion. For long periods, without men or money, neither side mounted formal campaigns, and when actions were taken, they were often driven as much by political considerations, such as Portugal's need to impress potential allies, as by clear military objectives. Year after year, given the problems of campaigning in the winter, and the heat and dry conditions of summer, most of the serious fighting was confined to two relatively short "campaign seasons" in the spring and autumn.
 The war settled into a pattern of mutual destruction. As early as December 1641, it was common to hear Spaniards throughout the country lament that "Extremadura is finished." Tax collectors, recruiting officers, billeted soldiers, and depredations by Spanish and foreign troops were loathed and feared by the Spanish population as much as raids by the enemy. In Extremadura, local militias bore the brunt of the fighting until 1659, and the absence of these part-time soldiers was extremely harmful to agriculture and local finances. Since there was often no money to pay or support the troops (or to reward their commanders), the Spanish crown turned a blind eye to the smuggling, contraband, profiteering, disorder, and destruction that had become rampant on the frontier. Similar conditions also existed among the Portuguese.
 The war was also expensive. In the 1650s, there were over 20,000 Spanish troops in Extremadura alone, compared to 27,000 in Flanders. Between 1649 and 1654, about 29 percent (over six million ducats) of Spanish defence spending was appropriated for fighting Portugal, a figure that rose during the major campaigns of the 1660s. Portugal was able to finance its war effort because of its ability to tax the spice trade with Asia and the sugar trade from Brazil, and it received some support from the European opponents of Spain, particularly France and England.
 The 1650s were indecisive militarily but important on the political and diplomatic fronts, with the brief exception of the Battle of the Lines of Elvas in 1659. The death of John IV in 1656 signalled the beginning of the regency of his wife, followed by a succession crisis and a palace coup (1662). Despite these domestic problems, the expulsion of the Dutch from Brazil (1654) and the signing of a treaty with England (also in 1654) improved Portugal's diplomatic and financial position temporarily and gave it needed protection against a naval raid on Lisbon.
 Nonetheless, the overriding goal, a formal pact with France, continued to evade Portugal, whose weakness and isolation had been driven home by its virtual exclusion at the negotiations for the European settlement-of-settlements, the new realpolitik of the Peace of Westphalia (1648).
 With this treaty and the end of hostilities in Catalonia in 1652, Spain was again ready to direct its efforts against Portugal, but it faced a lack of men, resources, and, especially, good military commanders.
 By 1662, Spain had committed itself to a major effort to end the war. John of Austria the Younger, Philip IV's illegitimate son, led 14,000 men into Alentejo, and, the following year, they succeeded in taking Évora, the major city of the region.
 The Portuguese, under António Luís de Meneses, 1st Marquess of Marialva, were bolstered by the arrival of a British brigade which numbered 3,000 in August 1662. Many were veterans of the English Civil War and the Dutch Revolt. For King Charles II, this was a convenient way of getting rid of demobilized soldiers of Cromwell's New Model Army and removing them from English territory. They were led by the German soldier of fortune, Friedrich Hermann von Schönberg, Count of Mértola, The brigade under Schomberg's leadership, proved a decisive factor in winning back Portugal's independence.
 They defeated the Spanish in a major engagement at Ameixial on 8 June 1663, and this forced John of Austria to abandon Évora and retreat across the border with heavy losses.
 The Portuguese now had some 30,000 troops in the Alentejo-Extremadura theatre, but they could not draw the Spanish again into a major engagement until June 1665, when a new Spanish commander, the marquis of Caracena, took over Vila Viçosa with about 23,000 men, including recruits from Germany and Italy.
 The Portuguese relief column under António Luís de Meneses and Schomberg met them at Montes Claros on 17 June 1665. The Portuguese infantry and artillery emplacements broke the Spanish cavalry, and the Spanish force lost over 10,000 men, including casualties and prisoners. Shortly thereafter, the Portuguese retook Vila Viçosa. These were the last major engagements of the war.
 Both sides returned to skirmishing campaigns. Portugal, with the intercession of its English ally, had sought a truce, but after the decisive Portuguese victory at Montes Claros and with the signing of a Franco-Portuguese treaty in 1667, the Spanish Habsburgs finally agreed to recognize the House of Braganza as Portugal's new ruling dynasty on 13 February 1668.
 The five major battles of the war were:
 The Portuguese were victorious in almost all of these engagements, and peace was concluded, with the help of English mediation, by the Treaty of Lisbon in 1668.
 For Portugal, its restoration of independence from Spain was clearly established, and it proved that it could fend for itself, albeit with difficulty. Its victories on the battlefield had re-awakened Portuguese nationalism.
 Economically, Portugal's restoration of independence freed it to pursue the course mapped out by the pioneers of commercial imperialism. During the seventeenth century, its economy depended largely upon entrepôt trade in tobacco and sugar, and the export of salt. During the eighteenth century, even though staples were not abandoned, the Portuguese economy came to be based more upon enslaved people, gold, leather, and wine. Portuguese trade, centered in the busy port of Lisbon, was most influenced by Anglo-Dutch capitalism and by the colonial economy in Brazil.
Luís de Meneses, the Count of Ericeira, economic adviser to the prince regent, advocated the development of a native textile industry based on a Flemish model. Factories were established at Covilhã, in an area of central Portugal where there was easy access to flocks of sheep and clean mountain water, but they were highly unpopular with both local consumers and traditional weavers. Meanwhile, Portuguese attempts to develop a silk industry were undercut by the French, who wanted to monopolize that market.
 More importantly, after 1668, Portugal, determined to differentiate itself from Spain, turned to Western Europe, particularly France and England, for new ideas and skills. This was part of a gradual "de-Iberianization", as Portugal consolidated its cultural and political independence from Spain. Portuguese nationalism, aroused by success on the battlefield, produced hostile reactions to Spain and to Spanish things and persons. By this time, Portuguese society was composed of two basic elements: those who participated in the gradual Europeanization process, the “political nation,” and those who remained largely unchanged, the majority of the people who remained apolitical and passive.
 Macau, the Portuguese colony in the Far East, remained loyal to the Portuguese monarch during the entire occupation period. Thus it was awarded the title “Cidade do Nome de Deus, Macau, Não Há Outra Mais Leal”, or “City by the Name of God, Macau, There Is None More Loyal” by King John IV of Portugal in 1654.