The first king of this tiny country, washed by the Atlantic, and blessed with fine seamen, navigators and harbours, was Alfonso I, in 1139, but the Portuguese Empire as such began in the fifteenth century. Portuguese ships were making voyages of discovery right round the world. Perhaps her immediate neighbour, Spain, felt that Portugal should belong to her, and by 1580 she did. This situation, most unpopular with the Portuguese, lasted from the above mentioned date until 1668. The French invaded in 1807, and the monarchy was overthrown. Most of the Empire vanished with the loss of Brazil, Goa and Macao.
That union of crowns in 1640 brought nothing but unrest in Portugal, partly because the people quickly noted that Spain was not ready (or able) to defend and protect the vast Portuguese possessions overseas. When troubles started up (again) in Cataluña, powerful Portuguese were encouraged to gather round the standard of the Duke of Braganza. They proclaimed him King Joao IV during an uprising in the capital, Lisbon in December, 1640, which ended with the murder of the Spanish Viceroy Vasconcellos. This was a serious mistake, for Vasconcellos was a personal friend and confidant of the all-powerful Conde-Duque de Olivares, the Spanish minister who managed Spain for the King. No-one, perhaps not even the King, had more power than Olivares at that stage.
It was however, very difficult for the Conde-Duque, because his commitments in rebellious Cataluña rendered him unable to deal adequately with the revolt in Portugal; and France, always ready to bash Spain or England, especially when they were down, entered the fray by sending troops and ships to aid Portugal.
In 1660 Catherine of Braganza married King Charles II, who had been restored to the English throne after years of exile following the execution of his father. This move assured the Portuguese of English help. After a number of disastrous defeats the Spanish had to recognise Portugal’s total independence in the Treaty of Lisbon in February, 1668.