Morocco was originally inhabited by Berber tribes. In the 7th century AD, Arab Muslims conquered the region, introducing Arabic and Islam. The Idrisid dynasty established independence in the 9th century. Subsequent Berber dynasties ruled: Almoravids (11th century, founded Marrakesh), Almohads (12th century, created an empire spanning Spain and North Africa), Marinids (13th century), Saadians (16th century). Since the 17th century, the Alaouite dynasty has ruled continuously.