During the Reconquista and mainly following the conquest of Granada in 1492, forces of the Castilian and Portuguese kingdoms conquered and maintained numerous posts in North Africa for trade and as a defence against Barbary piracy.

In 1415, the Portuguese conquered the Spanish city of Ceuta.
In 1481, the Papal bull Aeterni regis had granted all land south of the Canary Islands to Portugal.
Only this archipelago and the possessions of Santa Cruz de la Mar Pequeña (1476–1524), Melilla (conquered by Pedro de Estopiñán in 1497), Villa Cisneros (founded in 1502 in current Western Sahara), Mazalquivir (1505), Peñón de Vélez de la Gomera (1508), Oran (1509–1708; 1732-1792), Algiers (1510–1529), Bugia (1510–1554), Tripoli (1511–1551), and Tunis (1535–1569) remained as Spanish territory in Africa.
Finally, following the independence of Portugal from Spain, Ceuta was ceded by Portugal to Spain in 1668.

In 1848, Spanish troops conquered the Islas Chafarinas.
In the late 19th century, after the so-called Scramble for Africa, European nations had taken over colonial control of most of the African continent.
The Treaty of Fez (signed on 30 March 1912) made most of Morocco a protectorate of France, while Spain assumed the role of protecting power over the northern part, Spanish Morocco.

When Spain relinquished its protectorate and recognized Morocco's independence in 1956, it did not give up these minor territories.
Spain had held them well before the establishment of its protectorate.

On 11 July 2002, Morocco stationed six gendarmes on Perejil Island, which was at the time a source of complaint by Spain.
The Spanish Armed Forces responded by launching a military operation code-named Operation Romeo-Sierra.
The attack was carried out by Spanish commandos of Grupo de Operaciones Especiales.
The Spanish Navy and Spanish Air Force provided support; the six Moroccan navy cadets did not offer any resistance and were captured and evicted from the island.
It has since been evacuated by both countries.
During the Reconquista and mainly following the conquest of Granada in 1492, forces of the Castilian and Portuguese kingdoms conquered and maintained numerous posts in North Africa for trade and as a defence against Barbary piracy.
In 1415, the Portuguese conquered the Spanish city of Ceuta. In 1481, the Papal bull Aeterni regis had granted all land south of the Canary Islands to Portugal. Only this archipelago and the possessions of Santa Cruz de la Mar Pequeña (1476–1524), Melilla (conquered by Pedro de Estopiñán in 1497), Villa Cisneros (founded in 1502 in current Western Sahara), Mazalquivir (1505), Peñón de Vélez de la Gomera (1508), Oran (1509–1708; 1732-1792), Algiers (1510–1529), Bugia (1510–1554), Tripoli (1511–1551), and Tunis (1535–1569) remained as Spanish territory in Africa. Finally, following the independence of Portugal from Spain, Ceuta was ceded by Portugal to Spain in 1668.
In 1848, Spanish troops conquered the Islas Chafarinas. In the late 19th century, after the so-called Scramble for Africa, European nations had taken over colonial control of most of the African continent. The Treaty of Fez (signed on 30 March 1912) made most of Morocco a protectorate of France, while Spain assumed the role of protecting power over the northern part, Spanish Morocco.
When Spain relinquished its protectorate and recognized Morocco's independence in 1956, it did not give up these minor territories. Spain had held them well before the establishment of its protectorate.
On 11 July 2002, Morocco stationed six gendarmes on Perejil Island, which was at the time a source of complaint by Spain. The Spanish Armed Forces responded by launching a military operation code-named Operation Romeo-Sierra. The attack was carried out by Spanish commandos of Grupo de Operaciones Especiales. The Spanish Navy and Spanish Air Force provided support; the six Moroccan navy cadets did not offer any resistance and were captured and evicted from the island. It has since been evacuated by both countries.
Plazas de soberanía