After Isma'il's death, the country was plunged into disarray as his sons fought over his succession, but order was re-established under the long reign of Muhammad ibn Abdallah in the second half of the 18th century.
Today, the Moroccan government is officially a constitutional monarchy,[9][10][11] but the king retains strong authoritarian power over the state and public affairs, despite some political reforms in recent decades.
The Tafilalt was an oasis region in the Ziz Valley in eastern Morocco and the site of Sijilmasa, historically an important terminus of the trans-Saharan trade routes.
This was the example of one family member, Ali al-Sharif (not to be confused with the later 'Alawi by the same name below), who participated in battles against the Portuguese and Spanish in Ceuta and Tangier and who was also invited by the Nasrids of Granada to fight against Castile on the Iberian Peninsula.
[3]: 222, 228 When Abu Hassun extended his control to the Tafilalt region in 1631, the Dala'iyya in turn sent forces to enforce their own influence in the area.
His son Sidi Mohammed (or Muhammad II[1]), became the leader after 1635 and successfully led another rebellion which expelled Abu Hassun's forces in 1640 or 1641 (1050 AH).
[3]: 228–229 [22]: 224–225 The Dala'iyya invaded the region again in 1646 and following their victory at Al Qa'a forced him to acknowledge their control over all the territory west and south of Sijilmasa.
When Sidi Mohammed attacked Angad to force his rebellious brother's submission on August 2, 1664, he was instead unexpectedly killed and his armies defeated.
[1][22] He distinguished himself as a ruler who wished to establish a unified Moroccan state as the absolute authority in the land, independent of any particular group within Morocco – in contrast to previous dynasties which relied on certain tribes or regions as the base of their power.
In practice, he still had to rely on various groups to control outlying areas, but he nonetheless succeeded in retaking many coastal cities occupied by England and Spain and managed to enforce direct order and heavy taxation throughout his territories.
[3]: 230–237 [22]: 225–230 [1] He also moved the capital from Fez to Meknes, where he built a vast imperial kasbah, a fortified palace-city whose construction continued throughout his reign.
[29] Sidi Mohammed ibn Abdallah maintained the peace in part through a relatively more decentralized regime and lighter taxes, relying instead on greater trade with Europe to make up the revenues.
After his death in 1790, his son and successor Mawlay Yazid ruled with more xenophobia and violence, punished Jewish communities, and launched an ill-fated attack against the Spanish city of Ceuta in 1792, in which he was mortally wounded.
Suleyman's successor, Abd al-Rahman (or Abderrahmane; ruled 1822–1859), tried to reinforce national unity by recruiting local elites of the country and orchestrating military campaigns designed to bolster his image as a defender of Islam against encroaching European powers.
The French, led by the marshall Bugeaud, pursued him and thoroughly routed the Moroccan army at the Battle of Isly, near Oujda, on August 14.
The treaty made the superior power of France clear and forced the sultan to recognize French authority over Algeria.
[32] In the latter part of the 19th century Morocco's instability resulted in European countries intervening to protect investments and to demand economic concessions.
Sultan Hassan I called for the Madrid Conference of 1880 in response to France and Spain's abuse of the protégé system, but the result was an increased European presence in Morocco—in the form of advisors, doctors, businessmen, adventurers, and even missionaries.
By the guidance of the French regime, he had spent most of his life growing up in relative isolation inside the royal palace in Meknes and Rabat.
The nationalists, for their part, and in contrast with other anti-colonial movements like the Salafis, saw the sultan as a potentially useful tool in the struggle against French rule.
[39]: 250 The sultan refrained from openly associating with the nationalist movement in the 1930s, but nonetheless resisted French attempts to shift the terms of the Protectorate during the interwar years.
This momentous change also allowed the sultan more political manoeuvring room, and during the Anfa Conference in 1943, which Allied leaders attended, Mohammed V was left alone at one time with President Roosevelt, who expressed support for Moroccan independence after the war.
In the following years the tensions increased, with French officials slowly acknowledging the need for Moroccan independence but stressing for slower reforms rather than rapid sovereignty.
The French enlisted many powerful collaborators such Thami el-Glaoui to organize a campaign of public opposition to the sultan and demands for his abdication – also known as the "Qa'id Affair" – in the spring of 1953.
[39] The exile of the sultan did not alleviate French difficulties in Morocco, and an insurgency broke out which targeted both the regime and its collaborators with boycott campaigns as well as acts of violence.
[32][39] At independence, the Moroccan makhzen (royal government) remained underdeveloped and urgent reforms were needed to resolve problems arising from decades of colonial rule.
The constitution had been written by officials appointed by the king and in practice it cemented the monarchy's rule by granting it far-reaching executive powers.
This in turn was met with increased political repression and Hassan II largely relied on the army and police as instruments of power.
The period from roughly 1975 to 1990 is known as the "Years of Lead", as state violence was regularly deployed against dissenters and political opponents were jailed or disappeared.
He organized the Green March, which saw around 350,000 Moroccans crossing the southern border to settle inside the territory, triggering a war with the Polisario, the armed front of the Sahrawi people.