23 January 1641. The French now persuaded the Catalan Courts to recognise Louis XIII as Count of Barcelona, and ruler of Catalonia. On 26 January, a combined French-Catalan force routed a larger Spanish army at Montjuïc and secured Barcelona. However, the rebels soon found the new French administration differed little from the old, turning the war into a three-sided contest between the Franco-Catalan elite, the rural peasantry, and the Spanish. There was little serious fighting after France took control of Perpignan and Roussillon, establishing the modern Franco-Spanish border in the Pyrenees. The revolt ended in 1651 with the Spanish capture of Barcelona. Outside Europe In 1580, Philip II of Spain also became ruler of the Portuguese Empire, creating the Iberian Union; long-standing commercial rivals, the 1602 to 1663 Dutch–Portuguese War was an offshoot of the Dutch fight for independence from Spain. The Portuguese dominated the trans-Atlantic economy known as the Triangular trade, in which slaves were transported from West Africa and Portuguese Angola to work on plantations in Portuguese Brazil, which exported sugar and tobacco to Europe. Known by Dutch historians as the 'Great Design", control of this trade would not only be extremely profitable but also deprive the Spanish of funds needed to finance their war in the Netherlands. The Dutch West India Company was formed in 1621 to achieve this purpose and a Dutch fleet captured the Brazilian port of Salvador, Bahia in 1624. After it was retaken by the Portuguese in 1625, a second fleet established Dutch Brazil in 1630, which was not returned until 1654. The second part was seizing slave trading hubs in Africa, chiefly Angola and São Tomé; supported by the Kingdom of Kongo, whose position was threatened by Portuguese expansion, the Dutch successfully occupied both in 1641. Spain's inability or unwillingness to provide protection against these attacks increased Portuguese resentment and were major factors in the outbreak of the Portuguese Restoration War in 1640. Although ultimately expelled from Brazil, Angola and São Tomé, the Dutch retained the Cape of Good Hope, as well as Portuguese trading posts in Malacca, the Malabar Coast, the Moluccas and Ceylon. Peace of Westphalia (1648) The Peace of Westphalia actually consisted of three separate agreements; the Peace of Münster between Spain and the Dutch Republic, the Treaty of Osnabrück between the Empire and Sweden, plus the Treaty of Münster between the Empire and France. Preliminary discussions began in