In the 13th century the Marinids, a Berber dynasty, ruled what is now this country with Fez as their capital
The Berber dynasties (Almoravids, Almohads, Marinids and ... ruled Morocco 
from the 13th to the 15th century.