In the year 1143 Alfonso I of Portugal signed the Treaty of Zamora with Alfonso VII of León, establishing an independent Portuguese kingdom that was recognized thirty-six years later by Pope Alexander III through the bull manifestis probatum. The new country would still have to establish itself territorially, finishing its Reconquest, incorporating important cities and overcoming the danger posed by the Castilian invasion attempt in Aljubarrota in 1385.
Once all this was resolved, Portugal entered a period of splendor known as the Age of Discovery, at the hands of kings such as Juan II or Manuel I, great sailors such as Gil Eanes or Bartolomé Díaz and other promoters such as Enrique the Navigator. Thanks to them, the Portuguese turned to the Atlantic, dominating its routes and controlling a good part of the west coast of Africa since the beginning of the 15th century.
That, after not a few frictions, forced the Castilla de los Reyes Católicos to project its expansionism in a different direction and that is how they arrived in America, in what was initially thought to be an alternative itinerary to the Indies to the one their neighbors were looking for. rounding the Cape of Good Hope. That race to the East was won by Portugal when Vasco de Gama arrived in India; Thus began the establishment of a network of commercial factories that marked out the new spice route and were later expanded by Pedro de Covilha, Álvarez del Cabral, Lorenzo de Almeida and others.
But, in the meantime, the Castilians had not folded their arms and while Cortés was immersed in the conquest of the Mexica empire, a Portuguese in the service of Carlos V, Fernando de Magallanes, set sail in command of what would be one of the most important naval voyages in History, trying to replicate Vasco de Gama in the opening of another itinerary to Asia, in his case surrounding South America. Magellan died during the undertaking but it was completed by Juan Sebastián Elcano and thus, apart from completing the first circumnavigation of the world, the door to the East Indies was also open for Spain.
In that tough Iberian competition, an island appeared off the Chinese coast that had already been inhabited for tens of thousands of years, outlining a Malayo-Polynesian-speaking people. As it was en route between the Portuguese colony of Malacca (founded by Alfonso de Albuquerque in Malaysia in 1511) and Japan, it was a matter of time before seafarers sighted it, something that finally happened sometime in the 16th century. It was baptized with the name of Formosa, which evidently means beautiful.
However, no European set foot on it until 1582, when one of the ships that sailed along that route sank and the occupants had to take refuge on the island. One of them was a Portuguese Jesuit named Francisco Pirez, who was the first to make a written description of the place, drawing attention to it. However, among the survivors there were also Spaniards, who informed the authorities of that unknown island territory as soon as they could.
By then, Spain was already installed in Asia and Oceania. Miguel López de Legazpi had founded the first settlement in Cebu in 1565, the origin of what would soon be the Captaincy General of the Philippines, dependent on the Viceroyalty of New Spain and expanded with the takeover of a series of islands and archipelagos such as Guam. (Magallanes, 1521-Legazpi, 1565), Palau (Gómez de Espinosa, 1522-Gómez de Villalobos, 1543), the Carolinas (Álvaro de Saavedra, 1528) and the Marianas (Legazpi, 1521).
There was also another circumstance: in 1580 Portugal joined the Spanish Monarchy when its throne became vacant after the death in the Battle of Alcázarquivir of King Sebastián I (1578) and that of his successor Cardinal Enrique two years later. Felipe II, son of Empress Isabella of Portugal, asserted his right to the throne. Antonio, prior of Crato, bastard son of the infant Luis I and grandson of King Manuel I, presented his own candidacy but the Duke of Alba took it upon himself to settle the issue by defeating him at the Battle of Alcántara.
However, one of the conditions accepted by Felipe to be able to reign was that neither the kingdom nor its overseas territories would become Castilian provinces. Something that, if it was not done by law, did actually happen because the Portuguese commercial monopoly at the other end of the world was dissolved little by little in favor of Manila, a port that connected with America through the Acapulco Galleon; He brought significant amounts of silver to the parians (markets), full of Chinese traders interested in the precious metal.
So the news that the Dutch had established themselves in Tainan Bay, south of Formosa, hit like a bomb. It was the year 1624 and by then the United Provinces (the independent part of the old Spanish Flanders, which retained the Netherlands in the southern part) were already a true commercial and maritime power thanks to the famous Dutch East India Company, created in 1602 to manage trade with Asia as a monopoly, with the ability to found colonies, declare wars, negotiate treaties, mint coins…
The Company, which had a headquarters in Batavia (Java) that maintained close commercial relations with the Japanese port of Nagasaki since 1609, decided to also found a city in Formosa to trade with China; they had already tried to drive the Portuguese out of Macau and tried to force their way into the Chinese Pescadores Islands (present-day Pengu), but in both cases the Dutch were repulsed. This time they opted for diplomacy and agreed with the Ming dynasty to settle in Formosa, whose colonization had not yet been carried out by anyone despite sporadic visits.
They built a colony called Orange, whose name was later changed to Fort Zeelandia and is now known as Anping, a coastal islet. An obvious threat to the economic interests of Manila, which is why the Captain General of the Philippines, Fernando de Silva, put Antonio Carreño Valdés at the head of an expedition that was to occupy the island and expel the new arrivals. On May 7, 1626, two hundred men landed to the north, in Jilung Bay, and founded the port of La Santísima Trinidad, today called Keelung, protected by an artillery bastion located on the islet at the entrance to the mouth. They renamed Formosa with the name of Todos los Santos.
Little by little, the Spanish were expanding and the following year a squadron with reinforcements arrived, which allowed a new settlement in 1629 which was baptized as Castillo (today Tamsui, which still preserves remains of the defenses built, the Fort of Santo Domingo , and traces of the Spanish language). From these bases, half a dozen missionaries carried out an intense evangelizing activity that achieved the conversion to Christianity of thousands of natives.
However, the Dutch not only did not leave but, seeing their presence in danger, attacked the Spanish from the sea in 1630. This meant the Spanish cut off from Manila and the interruption of the supply convoy, forcing the Spanish settlement to look for supplies in the interior by imposing heavy tributes and thus causing friction with the natives, who in 1636 rose up in arms and massacred half of the Tamsui garrison. Besieged from two fronts, without resources and hit by the typhoons typical of those latitudes, whose destructive effects caused an epidemic of malaria, the Spaniards had to leave Tamsui two years later to congregate in La Santísima Trinidad.
This was maintained until 1642, when another enemy fleet appeared before the walls, demolishing them with cannon fire and conquering the position after six days of resistance. The Spanish abandoned the island and never returned. Sebastián Hurtado de Corcuera, Governor of the Philippines, was found responsible and put on trial, spending five years in prison. But the reality is that by then the reign of Felipe IV had already entered a slow decline and, with other powers competing at sea, it was increasingly difficult for him to defend distant possessions.
In any case, the Dutch would not hold much longer in Formosa either, of which they controlled only the littoral zone; in 1662 the Chinese Zheng Chenggong, better known as Koxinga, expelled them.
General history of Spain and America (Luis Suárez Fernández)/How Taiwan bacame chinese. Dutch, Spanish and the colonization in the seventeenth century (Tonio Andrade)/An overview of the spaniards in Taiwan (1626-1642) (Jose Eugenio Borao)/The lord of the world. Felipe II and his empire (Hugh Thomas)/Wikipedia