Spain abandoned the territory in 1975 and, despite a ruling of the International Court of Justice that it should be allowed self-determination, it was divided by Morocco and Mauritania. The Polisario Front proclaimed the Sahrawi Arab Democratic Republic on 27 Feb 1976 and set up a government in exile. In 1979 Mauritania withdrew and Morocco occupied the rest of the territory. A referendum on independence was scheduled for 1992 but was never held.