In 1469, Ferdinand II of Aragon (king of Aragon) and Isabella I of Castile (queen of Castile) were married. After their deaths, their respective territories (until then governed separately) were governed jointly, in the person of their grandson, the Emperor Charles V. This can be considered the foundation of the modern Spanish state, albeit a decentralized one wherein the various component territories within the united crowns retained their particular historic laws and privileges.
The Balearic Islands were frequently attacked by Ottomans and Barbary pirates from North Africa; Formentera was even temporarily abandoned by its population. In 1514, 1515 and 1521, the coasts of the Balearic Islands and the Spanish mainland were raided by Turkish privateers under the command of the Ottoman admiral, Hayreddin Barbarossa. The Balearic Islands were ravaged in 1558 by Ottoman corsair Turgut Reis, and 4,000 people were taken into slavery.