The Banu Marin was a Berber tribe in the Almohad army. Originally nomads from north-eastern Morocco, they dominated Fez and Taza’s mountains as Almohad power faltered and occupied Meknes in 1245. By 1269, they had conquered most of what would become Morocco. Because they did not expand eastwards or play any lasting military role in Spain, they can be called Morocco’s real founders. Unlike the Almoravids or Almohads, the Marinids were not a reformist religious movement. Instead, they befriended the scholars and emphasized religious orthodoxy and scholarship, which they encouraged by introducing Saladin’s Egypt’s madrasa. Madrasas were residential colleges where students lived, supported by charity, and studied the great Islamic texts. It was a major step in the standardization of Islam in the cities.
The countryside, mountains, and deserts were home to Sufi religious brotherhoods (tariqas) growing rapidly stronger. Many of their leaders (called sharifs) claimed blood descent from the Prophet Muhammad and, intellectually, from the great Sufi teacher Abd al-Salam ibn Mashish (d. ca. 1227) tomb is at Jabal Alam, in the Jebala, was one of the holiest pilgrimage sites. Because the tariqas were so powerful, the Marinids generally tried to incorporate the sharifs and Sufis by marrying into their families.
The Marinids’ religious and political authority can be seen in their capital of Fez, where they built a virtually new city beside the old one to house their bureaucracy and soldiers. It was heavily fortified, with thick crenelated walls and a few strong gates closed securely at night. They used the same pattern at Salé-Chella, their fortified necropolis just outside Rabat. Otherwise, their most impressive religious buildings were madrasas such as those built by Sultan Abu Inan Faris (1348-1358) in Meknes and Fez and the Suq al-attarin (spice market) in Fez, which demonstrated the importance of trade in the Marinid economy. Fez was the main economic center because the gold routes through the Sahara had shifted eastwards, and Marrakesh declined. The leatherwork and cloth of Fez were famous.
The reign of Abu Inan Faris was the zenith of the Marinid dynasty. He was strangled by his chief minister (wazir), and a long struggle between sultans and wazirs began. Eventually, the Marinids became so weak that Granada’s ruler effectively controlled the state, a reversal of the past, when the rulers of al-Andalus had been dependent on Morocco.
Granada was the last Muslim outpost in al-Andalus, and Portugal and Castile pursued the Reconquista into Africa. In 1415 the Portuguese took Ceuta and then a series of fortresses on the Atlantic coast: Ksar es-Seghir (al-Qasr al-Saghir) (1458), Asila, and Tangier (1471). The Spanish took Santa Cruz de la Mar Pequeña near Agadir in 1476. The Marinid dynasty began to break up. The Berber tribe of the Banu Wattas monopolized wazir’s position, and, in 1472, one of them declared himself sultan. After the fall of Granada (1492), the Spanish took Melilla in the far north-east in 1497, Peñon de Alhucemas and two nearby islets in 1559, and Peñon de Vélez in the west in 1564, while the Portuguese seized control of the Atlantic coast by occupying Arguin (in modern Mauritania, 1499), Anfa (modern Casablanca, 1458), Agadir (1505), Safi (1507), Azemmour (1513), and Mazagan (al-Jedida) (1515).
The end of the Christian Reconquista in Iberia brought an invasion of another kind: a flood of refugees from the Iberian peninsula sought refuge in Morocco and settled in the north’s coastal cities. Not all were Muslim – there were at least 10,000 Jews. The loss of Iberia and the Christian invasion of the coast led to a wave of jihadist feeling across Morocco, particularly in the south, near the main Portuguese enclaves. The sharifs and the tariqas were led by an alliance that laid the foundation for a new dynasty.