The Western Sahara War was an armed conflict, lasting from 1975 to 1991, fought primarily between the Polisario Front and Morocco. The conflict erupted after the withdrawal of Spain from the Spanish Sahara in accordance with the Madrid Accords, by which it agreed to give administrative control of the territory to Morocco and Mauritania. The Polisario Front, backed by Algeria and Libya, desiring instead the establishment an independent Sahrawi state in the territory, fought both Mauritania and Morocco in quick succession, in an attempt to drive their forces out of the region. In 1979, Mauritania withdrew its forces from the disputed territory, and the Polisario Front and Morocco reached a ceasefire agreement in 1991. The war resulted in somewhere between 14,000 and 21,000 casualties between both sides.. Some 40,000–80,000 Sahrawi refugees were displaced as a result of the conflict; at present, most still reside in various Sahrawi refugee camps throughout the Tindouf province of Algeria.