# Morocco–Spain relations

Morocco and Spain maintain extensive diplomatic, commercial, and military ties. The Morocco–Spain border separates the plazas de soberanía (including Melilla and Ceuta) on the Mediterranean coast from the Moroccan mainland. Morocco's foreign policy has focused on Western partners, including neighboring Spain. Relations have, however, been historically tense and conflictive.

## History
### Precedents
#### Middle Ages

Taking advantage of the disputes related to the struggle for control in the Visigothic Kingdom of Hispania, the Umayyad Caliphate army led by Táriq ibn Ziyad crossed the Strait of Gibraltar in 711. This gave way to the Islamic conquest of the Iberian Peninsula. In the years to come, the Christian rulers fought or established political or commercial relations with the Muslim rulers, gaining control over the Iberian peninsula.
In the Simancas battle (839) against the Caliphate of Córdoba, the Kingdom of León gained control of the Duero in today´s province of Valladolid. This Caliphate lasted until its demise in the early 11th century and ensuing replacement by ephemeral Islamic statelets.
The Almohad dynasty had conquered Marrakesh in 1147 and had taken over the Almoravids in Al-Andalus at the same time. The milestone of this period is the Battle of Las Navas de Tolosa (1212) in which an array of Christian kingdoms supported the king of Castille against Almohad Caliphate in the north of Jaén´s province.
Vowing to counter the Castilian expansion initiated by 1265, Nasrid Granada required assistance from Fez in late 1274 and ceded the places of Algeciras and Tarifa to the Marinid Sultanate, which thus gained a foothold in the southernmost end of the Iberian Peninsula which ended with the battle of Río Salado (1340), when the king of Portugal and the king of Castille defeated both the Marinids and Nasrids.
The last of the Muslim territories in the Iberian peninsula was the Nasrid kingdom of Granada, which surrendered to the Catholic Monarchs in 1492 after the Granada War. Spanish jews were expelled, and many settled on the Barbary Coast.

#### Early modern period

As the Spanish and Portuguese empires divided the world by the Treaty of Tordesillas (1492), these kingdoms established cities on the Moroccan coast such Melilla (1497) by the Spanish or Ceuta (1415), Mazagan (1502) and Casablanca (1515) by the Portuguese. After the battle of Alcácer Quibir (1578) the Portuguese empire was ruled by the Spanish empire monarchs too.
Blamed for collaborating with the Regency of Algiers (Ottoman empire) and the Barbary pirates which raided the spanish coasts and trading vessels for goods and slaves, some 40,000 Moriscos arrived to Morocco after their final expulsion in 1609. They were not well received in the Cherifian empire, as they dressed in the Spanish way, spoke Spanish and were accused of conversion to Christianity. The piracy harbour of the Republic of Salé on the Bou Regreg river bank was founded by Moriscos from Hornachos, today's Badajoz.
During the 17th century Spain acquired Larache (1610-1689) from Mohammed esh Sheikh el Mamun in exchange for the Spanish support in the internal struggles of the Saadi sultanate against his brother Zidan Abu Maali. In 1689 it was seized by the troops of the Alaouite sultan Ismail Ibn Sharif.
In 1612, Spanish privateers stole the Zaydani Library, a collection of an estimated 4,000 manuscripts in literature and science belonging to Sultan Zidan bin Ahmad of the Saadi dynasty. These manuscripts are still kept at El Escorial.

### Late modern period

During the wars between Spain and the regency of Algiers, the cherifien empire sieged the Spanish city of Ceuta on several occasions during the late 17th century and the 18th century with help from the Kingdom of Great Britain. Also, on 1774 Melilla was sieged by the moroccans. During the U.S. war of independence against the United Kingdom, in 1777 Mohamed III endorsed the Spanish and French recognition of the U.S., masterminded by the governor of Spanish Louisiana, Luis de Unzaga y Amézaga. On 1780 Spain and Morocco signed the Treaty of Aranjuez regarding trade between the nations. However Ceuta was sieged again on 1790-1791.
Also, Spain occupied Tétouan from 1859 to 1862 according to the Treaty of Wad Ras (1860), after Abd al-Rahman found himself unable to control the moroccan tribes which raided Ceuta´s hinterland. As a result, Melilla´s perimeter was also broadened and the sultan recognized the Spanish right to establish a fishing port in Santa Cruz de la Mar Pequeña (a territory of uncertain location by that time) identified then where Sidi Ifni now stands. In the 1860 battle of Tetuan, the Mellah, or Jewish quarter, of Tetuan was sacked. This was followed by appeals in the European Jewish press to support Jewish communities like the one in Tetuan, leading to an international effort called The Morocco Relief Fund, in English. After Morocco paid the war reparations (partially through money lent by the British), in 1862 the spanish general Leopoldo O'Donnell retired his troops from Tétouan.
After 1863, a Spanish diplomatic mission led by Francisco Merry y Colom was sent to the court of the Moroccan Sultan in Marrakesh,$^{:255}$ with the specific goals of the rehabilitation of Muley El-Abbás, the sultan's hispanophile brother, the fostering of commercial activity in Ceuta and Melilla by means of the creation of a custom, the opening of the Port of Agadir to Spanish ships, facilitating the meat provision to Ceuta, and the improvement on the status of Spaniards in Morocco,$^{:255,313}$ establishing the basis for the peacetime commercial and diplomatic relations of Spain with the Sherifian Empire.$^{:335}$
In the wake of the visit of a Spanish delegation to Fez in 1877, a joint Hispano-Moroccan committee was created to determine the location of the territory of Santa Cruz de la Mar Pequeña, retroceded in the 1860 Treaty of Wad Ras. This committee eventually misidentified Santa Cruz de la Mar Pequeña with Ifni, actually located about 480 kilometers (298 mi) north of the real fortress. The Moroccan sultan accepted the identification in 1883, even if the border delimitation did not take place at the time and the effective Spanish occupation had to wait until 1934.
In 1905, a group of Sephardic Jews of Fes sent a letter in vernacular Moroccan Arabic (Darija) written in Hebrew letters to Alfonso XIII, King of Spain, asking him to establish a Spanish school in the mellah of Fes and to protect their community, which they described as descendants of Spain and therefore his subjects.
The Spanish Protectorate over Morocco was established 27 November 1912 by decree of the Treaty Between France and Spain Regarding Morocco. Relative to France, which was assigned control over most of the Moroccan State, Spain ended up with a small territory in northern Morocco, largely mountainous and not easily accessible, and to which the Cape Juby strip, a small strip of land in Southern Morocco, bordering with the Spanish Sahara added up. The city of Tangier became an international zone.

### Contemporary relations
#### Moroccan territorial claims on Spanish cities of Ceuta, Melilla, territorial Canary Islands water and Plazas de Soberanía

On 6 July 2002 Spanish military operations in the Alhucemas Islands were perceived to be an act of aggression by Morocco. On 11 July 2002, the Perejil Island crisis erupted; members of the Royal Moroccan Navy occupied the uninhabited Perejil Island off the North-African coast; 6 days later Spain launched the "Operation Romeo-Sierra" and 28 members of the Special Operations Groups of the Spanish Army took control of the islet evicting the 6 Moroccan cadets then present in the islet, who offered no resistance. On 31 July-1 August 2018 Morocco indefinitely closed the Beni Ansar Customs near Melilla aiming to suffocate trade in the Spanish city.
On 21 December 2020, following the affirmations of the Moroccan Prime Minister, Saadeddine Othmani, stating that Ceuta and Melilla "are as Moroccan as the [Western] Sahara" Spain's Secretary of State for Foreign Affairs Cristina Gallach urgently summoned the Moroccan Ambassador to Spain, Karima Benyaich, to convey that Spain expects respect from all its partners to the sovereignty and territorial integrity of its country and asked for explanations about the words of Othmani.
The two neighbours also have an unresolved dispute concerning territorial waters between Morocco and the Spanish Canary Islands in the Atlantic Ocean.

#### Western Sahara's political status

Morocco invaded the Spanish Sahara in the Green March in November 1975, and the Madrid Accords later ended the Spanish administration over the Western Sahara.
During the November 2020 SARD blockage of the N-1 road between Morocco and Mauritania, Spanish former Second Deputy Prime Minister Pablo Iglesias backed the SARD´s referendum´s arguments, clashing with the official position of the government expressed by Spanish Minister of Foreign Affairs Arancha González Laya.
On 22 April 2021, Spanish officials had announced that the Polisario Front leader Brahim Ghali was sent to Spain for COVID-19 hospitalization. Morocco reacted with several reciprocal and retaliatory measures, including granting the pro-Catalan independence politician Carles Puigdemont asylum on 30 April.
On 14 March 2022, Sánchez sent a letter to King Mohammed VI backing Morocco's Western Sahara Autonomy Proposal. This was a change in the official position about self-determination as the solution to the Western Sahara conflict. His decision was criticized by Unidas Podemos and the Spanish opposition. Sánchez visited Morocco in April 2022 and participated in an iftar with Mohammed VI and members of his entourage.

#### Illegal immigration

Morocco has received €343 million since 2018 to help it counter illegal migration.
On 17 May 2021, approximately 8,000 migrants crossed the Moroccan–Spanish border into Ceuta and Melilla passing around the jetties of Benzú and El Tarajal, after Moroccan security forces lessened control mechanisms following the hospitalization of Brahim Ghali in Spain. The Spanish military was deployed at the border to stop the influx. Morocco's actions were rejected by various officials of the European Union. In a cryptic manner, the Moroccan ambassador warned that "there are acts that have consequences and must be assumed", just before being recalled by the Ministry of Foreign Affairs on 18 June, in turn shortly after she was summoned by the Spanish foreign minister.
European Commission Vice President Margaritis Schinas warned that Europe would not "be intimidated by anyone on the subject of migration". The Moroccan move was described as an instance of coercive engineered migration and a case of grey zone operation, similarly to other asymmetrical challenges posed by Morocco underpinned by incremental and ambiguous measures below the threshold of war.
On 22 June 2023, Human Rights Watch accused authorities at the Melilla border of "exonerat[ing] their security forces" during the 2022 Melilla incident. Both countries were reported to have further agreed to cooperate on repatriations of illegal migrants.
As of April 2024, the Spanish government was conducting preparations to transfer the management of airspace to Morocco, after decades of it being managed by a state-owned company organized under the Spanish Ministry of Transport and operating from the air traffic control center in the Canary Islands.

#### Trade agreements

In the past, the failure to reach a deal for fisheries between the European Union and Morocco in 2001 complicated the relations between José María Aznar and Mohammed VI.
Morocco's Tanger Med port will pose competition that concerns Spanish ports. It was expected to achieve full capacity in 2014 at 5.5 million containers annually.
At a February 2023 summit in Rabat attended by Pedro Sánchez and Aziz Akhannouch, Spain and Morocco subsequently signed a series of multiple agreements to boost trade and investment, including credit lines of up to 800 million euros ($873 million).

#### Counterterrorrism and counternarcotics cooperation

Both countries have shared interests in counterterrorism and counternarcotics. Morocco notably assisted Spanish authorities in the investigation of the 2004 bombings in Madrid and this relationship continues. Moroccan soldiers have served under Spanish command in the United Nations Stabilization Mission in Haiti and Moroccan gendarmes have joined Spanish patrols to combat illegal immigration in the Strait of Gibraltar.

## Moroccan legal residents in Spain

According to the 2021 INE statistics, Moroccans are the largest immigration community in Spain with 930,221 citizens residing in the country. Moroccans in Spain live mainly in Barcelona, Madrid and Murcia.

## Resident diplomatic missions

* Embassy of Morocco in Madrid
* Consulate-General of Morocco in Algeciras
* Consulate-General in Barcelona
* Consulate-General of Spain in Larache

## Common history

* Hispania
* Caliphate of Cordoba
* Taifa of Ceuta (in Ceuta and Tangier)
* Almoravid Empire
* Almohad Empire
* Benimerin Empire
* Spanish protectorate in Morocco (1912-1956)
* Spanish Sahara (1884-1976)
* Ifni (1860-1969)
* Tangier International Zone (1940-1945)