Why was Western Sahara occupied by Morocco?

Why was Western Sahara occupied by Morocco? My blunt claim is that the country was occupied because of the cold war, the area’s rich amount of phosphates and King Hassan II’s need to quell internal oppostion. 
After Hassan II restricted parliamentary power with constitutional changes in 1970, there were two failed coups against his rule in 1971 and 1972, both led by army officers. After the second failed coup, the power of parliament was suspended (again) and several members of parliament and of the opposition were jailed or killed.
Hassan II found himself in a situation where he needed to rearrange the army into royalistic control and quell internal opposition, and what better way to do so than to occupy Western Sahara? 
With the occupation of Western Sahara, Morocco gained a nationalistic victory which gathered the nation symbolically, created more jobs and provided for a slight increase in living standards. 
By doing this, international attention was diverted from the abuses suffered by Moroccan democratic opposition. Also, the international community had an interest in restricting the Soviet influence in Northern Africa and the growing nationalistic and democratic sentiments in the region.
The original population of Western Sahara has a genuine cultural and historical claim to this area. The UN have supported this claim in more than 90 resolutions. 
So why have UN member countries around the world not done more in order to stop this? 
Recently, Morocco has redrawn its support to the last attempt of the UN to resume negotiations and resolve the situation, and again it seems that the occupation can continue with little protest. 
Unless countries which have a real financial and political power over Morocco step up their pressure, the population of Western Sahara might continue to live in refugee camps or the occupied territory under horrible conditions. 
Meanwhile, international companies continue to plunder Western Saharan resources and the democratic movement in Morocco is silenced.
Revised version of an original published by: 
Marie Palm (@marfpa)