This conflict is a complicated situation all around although I abhor this particular action. As with so much of Africa, this conflict is a remnant of European colonial civilization - in this case Spain, a country that "claimed" historically Moroccan territory but, unlike the French colonizers in French-speaking North Africa (Morocco, Algeria, Tunisia), did not leave a functioning infrastructure, bureaucracy or public school system behind. Since the Spanish left, it has become a bone of contention between Morocco and Algeria, primarily because of its natural resources although Algeria purports to support the independence movement.
http://en.wikipedia.org/wiki/Western_SaharaJames Baker - of 2000 election infamy - spent a lot of time from 2000-2004 proposing a referendum for the area. Both of his proposals failed and the current King of Morocco has stated that Morocco will accept no referendum. So the conflict continues.