In 1973, a group of students in the colony of Spanish Sahara set up a new liberation movement, the Frente Popular para la Liberación de Saguia el-Hamra y Río de Oro (POLISARIO). They were soon mounting attacks, at first on remote Spanish military posts and then on larger targets. In October 1974, they sabotaged the conveyor belt to the Bu Craa mines for the first time and stopped the export of phosphates.
The Franco regime in Spain was coming to an end, and the Spanish government realized that it would be impossible to hold onto the Sahara, but it insisted that 'self-determination' meant that a referendum should include the option of independence. King Hassan rejected the proposal and instead made a secret agreement with Moktar Ould Daddah to divide the Sahara once the Spanish left.
In September 1974, King Hassan asked the International Court of Justice for an opinion on the legality of Moroccan and Mauritanian claims to sovereignty over Western Sahara. The court could give only an advisory opinion, not a judgment, because the Spanish government refused to accept its jurisdiction. The court was asked two questions: was the territory terra nullius (subject to no state) when the Spanish colonized it, and, if not, what legal ties linked its inhabitants with those of Morocco and Mauritania? Moroccan lawyers argued for a historic religious allegiance to the sultan. The Mauritanian government argued for a common historic identity between the tribes of the two territories.
The ICJ's opinion, handed down in October 1975, found that the historic links between Morocco and Mauritania on the one hand and the inhabitants of the Western Sahara on the other were not ties of sovereignty. The population had the right to self-determination. King Hassan moved quickly to undermine the judgment. In November 1975, his government organized a 'Green March' across the border to claim the colony. Over half a million Moroccans took part: the claim to the Sahara was clearly a popular one in Morocco.
When the UN Security Council passed resolutions deploring the march, King Hassan opened negotiations with Spain and Mauritania, froze the Moroccan claims to Ceuta and Melilla, and signed accords with Spain giving Morocco control over the northern part of the colony and Mauritania control over the southern part. By 12 January 1976, Moroccan troops and the tiny Mauritanian army had occupied their allotted areas. POLISARIO could not stop them, although with Algerian help it fought a fierce guerrilla campaign from its bases in the refugee camps in Tindouf, just across the Algerian border. On 26 February, Spanish rule ended. The Algerian government recognized an independent Saharan state and supplied weapons and training to POLISARIO, whose government in exile, the Saharan Arab Democratic Republic (SADR), was based in the refugee camps. Several Sahrawi tribes, by some estimates almost half the population, moved to the camps to join them. The Mauritanian army soon gave up, and, in 1979, the Algerian government brokered an agreement under which Mauritania dropped all its claims. Moroccan troops then occupied the Mauritanian zone.
Apart from Algeria and, to some extent Libya, POLISARIO had no diplomatic support from Arab states, but its guerrilla campaign was remarkably successful. By 1976, POLISARIO units had disabled the phosphate-rock conveyor belt and attacked Laayoune. During the next two years, POLISARIO expelled the Moroccan army from inland posts and even operated far into in Morocco itself. This did not force the Moroccan forces out of the Western Sahara, but guerrilla attacks on the Mauritanian capital, Nouakchott, and the iron mines that provided most of the national income, drove Mauritania to bankruptcy. In July 1978, an army coup first overthrew Ould Daddah and then accepted POLISARIO's offer of a cease-fire. In April 1979, after another coup, the Mauritanian government recognized POLISARIO as the 'sole legitimate representative of the Saharan people', and renounced its claim. The Moroccan army moved south and occupied the rest of the former Spanish colony. From 1979 on, the Moroccan army faced increasingly effective POLISARIO forces, and the Saharan question became central to the survival of the Moroccan state. The King made no allowances for those who opposed the Saharan War, and the most savage repression was directed against them.
In fighting the war, the Moroccan government adopted two strategies. The first was demographic: a large-scale transfer of population into the region. Many people came from neighbouring, fully Moroccan Saharan regions, and some joined the local government elite. Civil servants, skilled workers, health professionals, and teachers were sent from all over Morocco to the Western Saharan provinces. In the mid-1980s, the government began a scheme for providing economic opportunities (subsidies, tax exemptions, and higher salaries than elsewhere in Morocco) to entice migrants who would help develop the Sahara. The number of inhabitants increased from 74,000 (Spanish census, 1974) to 507,160 today. The immigrants never really fused with the local people but became the majority of the population in the main cities of the Western Sahara. Indigenous Sahrawis were marginalized.
The second strategy was military. The Royal Armed Forces built a vast defensive wall of sand (known as the 'berm') across the desert, three hundred miles long, seven feet high, and protected by barbed wire and radar. By 1982, this perimeter had shut POLISARIO out of the 'useful Sahara': Laayoune, al-Semara, and the phosphate mines. Then new walls were built, further out. By 1985, POLISARIO guerrillas were excluded from most of the old Spanish colony. This strategy was extremely expensive up, but the Saudi Arabian government underwrote the cost.
The Moroccan government managed to repair relations with Libya's Colonel Gaddafi, but, despite general Arab diplomatic acquiescence, 73 states had recognized POLISARIO's paper republic by 1984, and the SADR was a full member of the Organization of African Unity (OAU). But the Algerian state was running out of money, and the OAU was able to cooperate with the UN to begin a slow peace process. In 1985, Javier Pérez de Cuellar, Secretary General of the UN, started a 'mission of good offices', and, in August 1988, Morocco and POLISARIO agreed settlement proposals – a UN-supervised reduction of troops in the Sahara and a referendum. The Moroccan government agreed, because the definition of eligible voters was kept deliberately vague. The Algerian government pressed POLISARIO to agree also, and Algeria and Morocco finally resumed diplomatic relations.
In 1990, the Security Council approved the full text of the settlement proposals and an outline plan for implementing them (UNSC Res. 658), and in April 1991, the Security Council, in Resolution 690, set up the UN Mission for the Referendum in Western Sahara (MINURSO), which is still in operation. A transitional period with a cease-fire was to lead to a referendum in January 1992; this did not happen.
MINURSO was deployed in September 1991, and the cease-fire generally held, but the transitional period never began. Voter eligibility was a major source of contention. MINURSO began identifying potential voters in August 1994, but this moved slowly, and the Secretary General suspended the identification process in May 1996. Most of MINURSO's civilian and police staff were withdrawn, and only the military component remained to monitor the cease-fire.