Spain’s two tiny enclaves on the north coast of Africa have long been a flashpoint in its relationship with Morocco, which the territories border.

The only such European territories on African soil, they include the autonomous city enclaves of Ceuta and Melilla, as well as Plazas de Soberanía – a group of rocky islands off the Moroccan coast, which include the Chafarinas Islands, Alhucemas Islands and Penon de Velez de la Gomera.

While Spain says it owns these enclaves, Morocco does not recognise Spain’s sovereignty over them and has been demanding their return since independence from France in 1956.

The territorial dispute has resulted in long-standing political tensions between Spain and Morocco.

Last week, after more than 50,000 migrants surged over the border into the Spanish enclave of Ceuta, those tensions between Madrid and Rabat intensified. While most have since returned to Morocco, several thousand remain in Ceuta this week.

So why does Spain have these territories at all and what does their future hold?

The enclaves of Ceuta and Melilla, along with a few islets off the coast of Morocco, constitute the last vestiges of the Spanish colonial empire.

Ceuta first came under Portuguese rule in 1415 before becoming part of Spain in 1580, while Melilla was conquered by a Spanish nobleman in 1497. Ceuta remained under Spanish control after Portugal regained independence in 1640 following a long war.