 During 1217, the Berber nomads and tribes clashed with the Marinids around Fes but were defeated.However Abd al-Haqq was mortally wounded during these clashes.The Marinids took possession of the Rif and were able to maintain their control of the region despite attempted counter-attacks by the Almohads.