The border starts in the north at the tripoint with Algeria, proceeding south in a straight of 146 kilometres (91 mi), then turning west following the 26th parallel north for 334 kilometres (208 mi), then turning south along the 12th meridian west for 176 kilometres (109 mi). The border then turns to the south-west via a broad arc down to 21°20'N, following this parallel westwards for 408 kilometres (254 mi). Just south of Guerguerat the border turns south, bisecting the Ras Nouadhibou peninsula and terminating at its tip on the Atlantic Coast.
The border emerged during the 'Scramble for Africa', a period of intense competition between European powers in the later 19th century for territory and influence in Africa. The process culminated in the Berlin Conference of 1884, in which the European nations concerned agreed upon their respective territorial claims and the rules of engagements going forward. As a result of this process, Spain announced its intention to declare a protectorate over the north-west African coast between Cape Bojador and Ras Nouadhibou (Cape Blanco/Cap Blanc), which was formally created as the Rio de Oro colony the following year. France had been granted control over much of West Africa, including what is now Mauritania, with their territories later federalised as French West Africa.
On 27 June 1900 France and Spain signed a treaty which created a border between Rio de Oro and French West Africa starting at Ras Nouadhibou and terminating at the junction of the 12th meridian west and the 26th parallel north (i.e. the bulk of the modern Mauritania–Western Sahara border). This boundary was then extended by a treaty of 3 October 1904 north up to what is now the tripoint with Algeria and then west along the parallel of 27°40'N, this latter line forming the modern Morocco–Western Sahara border; the new Spanish territory thus formed was named Saguia el-Hamra. Another Franco-Spanish treaty was signed on 27 November 1912 which created a French protectorate over most of Morocco, whilst ceding parts of the country to Spain viz. the Mediterranean littoral (the 'Northern Zone', or more commonly Spanish Morocco), the exclave of Ifni and the Cape Juby/Tarfaya Strip (aka the 'Southern Zone'), the latter forming what is now the far south of Morocco proper, between the Draa River and the Saguia el-Hamra border at 27°40'N agreed upon in 1904. The entire French West Africa-Saguia el Hamara/Rio de Oro boundary was confirmed by treaty on 19 December 1956, with France and Spain then demarcating it on the ground in 1957 with several pillars.
From 1946 to 1958 Spanish Morocco, the Tarfaya Strip, Ifni, Rio de Oro and Saguia el Hamra were united as Spanish West Africa. Morocco gained independence from France in 1956, including Spanish Morocco (minus the plazas de soberanía which remain part of Spain today). The newly independent state, inspired by the idea of creating a 'Greater Morocco', claimed all of Spanish West Africa as Moroccan land. In 1958 Spain merged Rio de Oro and Saguia el-Hamara in 1958 as Spanish Sahara; that same year Spain ceded the Tarfaya Strip to Morocco (via the Treaty of Angra de Cintra). Ifni was ceded in 1969 (following a failed Moroccan attempt to capture the region by force in 1957). Morocco then turned its sights to Spanish Sahara, however Mauritania (independent since 1960) also contested the territory, claiming the former colony of Rio de Oro as part of 'Greater Mauritania'. A railway was built in 1960-63 which paralleled the southern half of the boundary, including an expensive tunnel through an escapement north-west of Choum constructed so as to order to avoid the right-angle of the south-eastern Spanish Sahara. Saharawi nationalists had meanwhile formed the Polisario, seeking independence for the whole of Spanish Sahara as Western Sahara, and began a low-level guerrilla campaign. An International Court of Justice ruling on the matter in October 1975 stated that neither the Moroccan nor Mauritanian claims to Western Sahara were strong enough to justify annexation, and that the Saharawi people should be allowed to determine their own future. Morocco thereafter sought to settle the matter military, and in November 1975 conducted the 'Green March', in which thousands of soldiers and Moroccan nationalists forcibly crossed the Morocco-Spanish Sahara border. Spain's dictator Francisco Franco was at this time near-death, and the country was unwilling to respond militarily at such a delicate time, keen to avoid the kind of drawn-out colonial war that had bedevilled Portugal in its African colonies. Spain therefore signed a treaty with Morocco and Mauritania, splitting Spanish Sahara roughly in two, roughly two-thirds in Morocco's favour. By this treaty only the northern third of the traditional Mauritania–Western Sahara border remained extant. Polisario forces declared a Sahrawi Arab Democratic Republic based on the boundaries of Spanish Sahara, thus starting a long war against Morocco and Mauritania. Unwilling to continue the conflict, Mauritania pulled out of their zone in 1979, which was then annexed by Morocco, thereby reinstating the former Mauritania-Western Sahara frontier.
In the 1980s, in an effort to control the territory and stymie the Polisario, Morocco began building a number of elaborate walls (or 'berms'), eventually completing the Moroccan Western Sahara Wall in 1987. In the south the wall parallels the southern straight line section of the border out to the sea, effectively abandoning the Western Saharan half of the Ras Nouadhibou peninsula; at present Mauritania retains a military presence in the area. Morocco and Polisario signed a ceasefire agreement in 1991 ending the war; Morocco retained control of areas west of the wall (roughly 80% of Western Sahara), with Polisario controlling those east, which includes the entirety of the Mauritania-Western Sahara boundary. At present the dispute remains unresolved.
Settlements near the border
- CIA World Factbook – Western Sahara, archived from the original on 12 June 2007, retrieved 23 January 2020
- Brownlie, Ian (1979). African Boundaries: A Legal and Diplomatic Encyclopedia. Institute for International Affairs, Hurst and Co. pp. 437–44.
- International Boundary Study No. 149 – Mauritania-Western Sahara Boundary, 8 January 1975, retrieved 25 January 2020
- Campos-Serrano, Alicia; Rodríguez-Esteban, José Antonio (January 2017). "Imagined territories and histories in conflict during the struggles for Western Sahara, 1956–1979". Journal of Historical Geography. 55: 47. doi:10.1016/j.jhg.2016.11.009. hdl:10486/686245.
- Robert Rézette, The Western Sahara and the Frontiers of Morocco (Nouvelles Éditions Latines, 1975), p. 101.
- José Luis Villanova, "La organización política del territorio de Ifni duranta la dominación colonial española (1934–1969)", Anales: Revista de Estudios Ibéricos e Iberoamericanos 3 (2007): 49–82, esp. 62–72.
- "Case Summaries : WESTERN SAHARA: Advisory Opinion". icj-cij.org. International Court of Justice. 16 October 1975. Archived from the original on 11 February 2002.
- Milestones of the conflict Archived 21 February 2007 at the Wayback Machine, page 2. Website of the United Nations MINURSO mission.
- (in French) Abdallah Ben Ali, Guéguerre à Lagouira[permanent dead link], Maroc Hebdo International, issue 534, 22–28 November 2002
- (in French) Redouane Ramdani, Enquête: Aux frontières du réel Archived 2013-12-12 at the Wayback Machine, TelQuel, issue 248, 18–24 November 2004