north-west of present-day Algeria, before entering en masse into what is now Morocco by the beginning of the 13th century. They first frequented the area between Sijilmasa and Figuig, at times reaching as far as the in Algeria. They moved seasonally from the Figuig oasis to the Moulouya River basin. The Marinids took their name from their ancestor, Marin ibn Wartajan al-Zenati. Like earlier Berber ruling dynasties of North Africa and Al-Andalus had done, and in order to help gain legitimacy for their rule, Marinid historiography claimed an Arab origin for the dynasty through a North Arabian tribe. Rise After arriving in present-day Morocco, they initially submitted to the Almohad dynasty, which was at the time the ruling regime. Their leader Muhyu contributed to the Almohad victory at Battle of Alarcos in 1195, in central Iberian Peninsula, though he died of his wounds. His son and successor, Abd al-Haqq I, was the effective founder of the Marinid dynasty. Later, the Almohads suffered a severe defeat against Christian kingdoms of Iberia on 16 July 1212 in the battle of Las Navas de Tolosa. The severe loss of life at the battle left the Almohad state weakened and some of its regions somewhat depopulated. Starting in 1213 or 1214, the Marinids began to tax farming communities of today's north-eastern Morocco (the area between Nador and Berkane). The relationship between them and the Almohads became strained and starting in 1215, there were regular outbreaks of fighting between the two parties. In 1217 they tried to occupy the eastern part of present-day Morocco but were defeated by an Almohad army and Abd al-Haqq was killed. They were expelled, pulling back from the urban towns and settlements, while their leadership passed on to Uthman I and then Muhammad I. In the intervening years, they regrouped and managed to establish their authority again over the rural tribes in the regions around Taza, Fez, and Ksar el-Kebir. Meanwhile, the Almohads lost their territories in Al-Andalus to Christian kingdoms like Castile, the Hafsids of Ifriqiya broke away in 1229, followed by the independence of the Zayyanid dynasty of Tlemcen in 1235. The Almohad caliph Sa'id nonetheless managed to defeat the Marinids again in 1244, forcing them to retreat back to their original lands south of Taza. It was under the leadership of Abu Yahya, whose reign began in 1244, that the Marinids re-entered into the region on a