Countries will always have interests, and those interestsxwill differ with their neighbours. In this case, morocco is illegally occupying SADR land, and Algeria, an enemy of morocco, supports the legitimate SADR government.
Morocco has phosphate reserves and Algeria has oil and gas reserves...