[12] While little is known of settlements in Morocco during that period,[needs update] excavations elsewhere in the Maghreb region have suggested an abundance of game and forests that would have been hospitable to Mesolithic hunters and gatherers, such as those of the Capsian culture.
Morocco passed out of Umayyad and Abbasid control, and fragmented into a collection of small, independent Berber states such as Berghwata, Sijilmassa and Nekor, in addition to Tlemcen and Tahert in what is now western Algeria.
[29] After allying with the Sufri Kharijite rebellion in Morocco against the Umayyads, they established an independent state (CE 744 – 1058) in the area of Tamesna on the Atlantic coast between Safi and Salé under the leadership of Tarif al-Matghari.
[38]: 41 The overthrow of eastern authority meant that Morocco was controlled by various local Berber tribes and principalities which emerged around this time, such as the Barghwata Confederacy on the Atlantic coast and the Midrarid Emirate in Sijilmasa.
[45] After this Idrisids settled among the Jbala tribes in the Rif region of north-west Morocco where they partially rebuilt their power base from Hajar an-Nasr, alternately acknowledging either the Umayyads of Cordoba (under Abd ar-Rahman III) or the Fatimids as overlords.
[40]: 91 [38]: 82 Until the rise of the Sanhaja Almoravids later in the century, the Maghrawa controlled Fes, Sijilmasa and Aghmat while the Banu Ifran ruled over Tlemcen, Salé (Chellah), and the Tadla region.
[45] In the 11th century an Idrisid family descended from Umar (son of Idris II), the Hammudids were able to gain power in several cities of northern Morocco and southern Spain.
The Berbers of the Tamazgha in the early Middle Ages could be roughly classified into three major groups: the Zenata across the north, the Masmuda concentrated in central Morocco, and the Sanhaja, clustered in two areas: the western part of the Sahara and the hills of the eastern Maghreb.
Around 1124, Ibn Tumart erected the ribat of Tinmel, in the valley of the Nfis in the High Atlas, an impregnable fortified complex, which would serve both as the spiritual center and military headquarters of the Almohad movement.
[73]: 70 Although a Zenata Berber from Tagra (Algeria),[74] and thus an alien among the Masmuda of southern Morocco, Abd al-Mu'min nonetheless saw off his principal rivals and hammered wavering tribes back to the fold.
[76] In 1212, the Almohad Caliph Muhammad 'al-Nasir' (1199–1214), the successor of al-Mansur, after an initially successful advance north, was defeated by an alliance of the four Christian kings of Castile, Aragón, Navarre, and Portugal, at the Battle of Las Navas de Tolosa in the Sierra Morena.
His chief advisor, the shadowy Abu Zayd ibn Yujjan, tapped into his contacts in Marrakesh, and secured the deposition and assassination of Abd al-Wahid I, and the expulsion of the al-Jami'i clan.
Knowing they were outnumbered, the Almohad governors of the city refused to confront the Portuguese raiders, prompting the disgusted population of Seville to take matters into their own hands, raise a militia, and go out in the field by themselves.
Trust in the Almohad leadership was severely shaken by these events – the disasters were promptly blamed on the distractions of Caliph al-Adil and the incompetence and cowardice of his lieutenants, the successes credited to non-Almohad local leaders who rallied defenses.
He promptly purchased a truce from Ferdinand III in return for 300,000 maravedis, allowing him to organize and dispatch the greater part of the Almohad army in Spain across the straits in 1228 to confront Yahya.
Ibn Hud and the other local Andalusian strongmen were unable to stem the rising flood of Christian attacks, launched almost yearly by Sancho II of Portugal, Alfonso IX of León, Ferdinand III of Castile and James I of Aragon.
Following the arrival of the Arab Bedouins in North Africa in the middle of the eleventh century, the Marinids were obliged to leave their lands in the region of Biskra, in present-day Algeria.
During their stay in the Rif, the Almohad state suffered huge blows, losing large territories to the Christians in Spain, while the Hafsids of Ifriqia broke away in 1229, followed by the Zayyanid dynasty of Tlemcen in 1235.
In 1337 the Abdalwadid kingdom of Tlemcen was conquered, followed in 1347 by the defeat of the Hafsid empire in Ifriqiya, which made him master of a huge territory, which spanned from southern present-day Morocco to Tripoli.
As a result, the people of Morocco tended to regard the Saadians as heroes, making it easier for them to retake the Portuguese strongholds on the coast, including Tangiers, Ceuta and Maziɣen.
[113] They proclaimed a Republic, ruled by a council or Diwan, a sort of government cabinet formed by 12 to 14 notable people whose members annually elected a Governor and a Captain General of the Fortalesa during the month of May.
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.
The end of World War II that had weakened European colonial powers, the start of the US-URSS search for influence and the establishment of the United Nations in 1945 praising universal equality, represented an impetus for anti-colonial and nationalist movements in Morocco.
[151] Nationalist political parties, which subsequently arose under the French protectorate, based their arguments for Moroccan independence on declarations such as the Atlantic Charter, a joint United States-British statement that set forth, among other things, the right of all peoples to choose the form of government under which they live.
[163]In December 1952, a riot broke out in Casablanca over the assassination of the Tunisian labour leader Farhat Hached; this event marked a watershed in relations between Moroccan political parties and French authorities.
[180] On 3 March 1973, Hassan II announced the policy of Moroccanization, in which state-held assets, agricultural lands, and businesses that were more than 50 percent foreign-owned—and especially French-owned—were transferred to political loyalists and high-ranking military officers.
[164] Following years of discontent and inequality during the 1980s, on 14 December 1990, a general strike was called by two major trade unions in the country to demand an increase in the minimum wage and other measures.
[188] In August 1974, Spain formally acknowledged the 1966 United Nations (UN) resolution calling for a referendum on the future status of Western Sahara and requested that a plebiscite be conducted under UN supervision.
However, buoyed by the increasing defection of tribal chiefs to its cause, the Polisario drew up a constitution and announced the formation of the Saharawi Arab Democratic Republic (SADR), and itself formed government-in-exile.
Even though the UN Security Council created a peacekeeping force to implement a referendum on self-determination for Western Sahara, it has yet to be held, periodic negotiations have failed, and the status of the territory remains unresolved.