The Marinid dynasty (Arabic: المرينيون al-marīniyyūn) was a Berber Muslim dynasty that controlled present-day Morocco from the mid-13th to the 15th century and intermittently controlled other parts of North Africa (Algeria and Tunisia) and of the southern Iberian Peninsula (Spain) around Gibraltar. It was named after the Banu Marin (Arabic: بنو مرين, Berber: Ayt Mrin), a Zenata Berber tribe. It ruled the Marinid sultanate, founded by Abd al-Haqq I.
In 1244, after being at their service for several years, the Marinids overthrew the Almohads which had controlled Morocco. At the height of their power in the mid-14th century, during the reigns of Abu al-Hasan and his son Abu Inan, the Marinid dynasty briefly held sway over most of the Maghreb including large parts of modern-day Algeria and Tunisia. The Marinids supported the Emirate of Granada in al-Andalus in the 13th and 14th centuries and made an attempt to gain a direct foothold on the European side of the Strait of Gibraltar. They were 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. Starting in the early 15th century the Wattasid dynasty, a related ruling house, competed with the Marinid dynasty for control of the state and became de facto rulers between 1420 and 1459 while officially acting as regents or viziers. 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.