Iberian Union follows War of the Portuguese Succession
The Iberian Union was the dynastic union of the Crowns of Castile and Aragon and the Kingdom of Portugal that existed between 1580 and 1640 and brought the entire Iberian Peninsula, as well as Portuguese and Spanish overseas possessions, under the Spanish Habsburg monarchs Philip II, Philip III, and Philip IV. The union began after the Portuguese crisis of succession and the ensuing War of the Portuguese Succession, and lasted until the Portuguese Restoration War, during which the House of Braganza was established as Portugal's new ruling dynasty with the acclamation of John IV as the new King of Portugal. This was a personal union, so the Kingdoms of Portugal and Spain remained independent states, sharing only a single monarch.
The kings from the Spanish branch of the House of Habsburg were the only element that connected the multiple kingdoms and territories, ruled by the six separate government councils of Castile, Aragon, Portugal, Italy, Flanders-Burgundy, and the Indies. For periods, Portugal maintained a viceroy, appointed by the King, although the turnover was often rapid; in the 60 years of the Union, the country had 13 viceroys and four regency councils (see List of viceroys of Portugal). The governments, institutions, and legal traditions of each kingdom remained independent of one another. Alien laws (Leyes de extranjería) determined that a national of one kingdom was a foreigner in all other kingdoms.