Zenata

[9]: 38 [10]: 212  While the Umayyads managed to defeat the rebels eventually and reassert some of their authority, the westernmost parts of the Maghreb, including what is now Morocco, remained outside of Arab caliphal rule.

[9][10]: 207  In this vacuum, various principalities arose in the region, such as the Midrarid Emirate in eastern Morocco, led by a Zenata Miknasa tribe,[11] to which the foundation of the city of Sijilmasa is attributed.

[12][9]: 49 In 868, under the leadership of the Abd al-Razzaq, the Berber Khariji Sufri tribes of Madyuna, Ghayata and Miknasa formed a common front against the Idrisids of Fez.

[9]: 52 [13] Starting in the early 10th century, however, the Fatimids in the east began to intervene in present-day Morocco, hoping to expand their influence, and used the Miknasa as proxies and allies in the region.

[15]: 91 [9]: 82  Until the rise of the Sanhaja Almoravids later in the century, the Maghrawa controlled Fez, Sijilmasa and Aghmat while the Banu Ifran ruled over Tlemcen, Salé (Chellah), and the Tadla region.

[17] They supported the Emirate of Granada in al-Andalus in the 13th and 14th centuries; an attempt to gain a direct foothold on the European side of the Strait of Gibraltar was however defeated at the Battle of Río Salado in 1340 and finished after the Castilians took Algeciras from the Marinids in 1344, definitively expelling them from the Iberian Peninsula.

[14] The Marinids also pioneered the construction of madrasas across the country which promoted the education of Maliki ulama, although Sufi sheikhs increasingly predominated in the countryside.

In 1465 the last Marinid sultan, Abd al-Haqq II, was finally overthrown and killed by a revolt in Fez, which led to the establishment of direct Wattasid rule over most of Morocco.

The Wattasid sultans in turn lasted until the mid-16th century, when they were finally overthrown by the Saadians, who inaugurated the beginning of Arab Sharifian rule over Morocco (which continues under the present-day Alaouite dynasty).

[28][26] They were highly mobile on the field, armed with lances, javelins, and small round shields known for their flexibility, and used their own characteristic set of tactics.

[26] They also served as mercenaries in the armies of Christian kingdoms such as Castile[29] or as auxiliaries sent by the Nasrid emirs of Granada to aid their Castilian allies.