The Madrid Accords, also called Madrid Agreement or Madrid Pact, was a treaty between Spain, Morocco, and Mauritania to end the Spanish presence in the territory of Spanish Sahara, which was until the Madrid Accords' inception a Spanish province and former colony. It was signed in Madrid on November 14, 1975, although it was never published on the Boletin Oficial del Estado. This agreement was in conflict with the Law on decolonization of Sahara, ratified by the Spanish Parliament (Cortes) on November 18. In cause of the Madrid agreement, the territory would then be divided between Morocco and Mauritania.
The province's future had been in dispute for several years, with both Morocco and Mauritania demanding its full annexation to their territory and Spain attempting to introduce either a regime of internal autonomy or a Sahrawi pro-Spanish independent state. Additionally, an independent group of indigenous Sahrawis called the Polisario Front sought independence through guerrilla warfare. The United Nations had since 1963 regarded the area as a colony, and demanded self-determination for it in accordance with .
The Madrid Accords followed on the heels of the Green March, a 350,000 strong Moroccan demonstration called by King Hassan II, intended to put pressure on Spanish authorities.
Rabat had been claiming the territory as historically Moroccan since its accession to independence in 1956. Immediately after Morocco's independence, the Moroccan Liberation Army's southern branch, the Saharan Liberation Army, had battled Spanish troops in Sidi Ifni, Saguia el-Hamra and Río de Oro, and managed to free most of the territory. Madrid later regained full control in 1958 with French help. Moroccan demands for the territory continued in the 1960s and increased in intensity in the early 1970s as it became apparent that colonialism was expiring.