In the 12th and 13th centuries, under the Almoravid and Almohad dynasties, Morocco controlled much of Spain, Portugal, and North Africa. However, as the Ottoman Empire declined, Spain, France Germany and Britain took an interest in Morocco; and she fell victim to the politicking between the 4 European countries, all vying for power and control. Following internal civil unrest, a weakened Morocco was forced to become a protectorate of France with the treaty of Fez in 1912. The Sultan continued to reign, but did not actually rule. Moroccans continued to fight French rule, but declared Morocco a protectorate of France, with some areas controlled by Spain.
Moroccan uprisings against France and Spain mired the next 40 years, with the Istiqlal Party declaring full independence in 1944, a declaration approved by the Sultan. Refusal of France to accept any change in the status quo combined with the forced exile of the Sultan in 1954 sparked active civil and religious opposition. In 1955 France surrendered with the return of Morocco’s leader Muhammed V. Morocco was granted independence from France and Spain in 1956. Despite this, Spain still didn’t concede the the western desert of Sahara until strategic mass demonstrations in November of 1975 led to a fully waged war that lasted 16 years. It is now known as the Sahrawi Arab Democratic Republic, but is still the subject of dispute with Morocco. After the death of Hasan Ibn Muhammed, Morocco became a constitutional monarchy in 1977. Today Morocco has arguably the cleanest human rights record in Africa and the Middle East.