Idris I (Moulay Idris) founded the Idrisid dynasty in 788 CE, establishing the first independent Moroccan Islamic state. A descendant of the Prophet Muhammad (via Hasan ibn Ali), he fled Abbasid persecution, arrived in Volubilis, and was welcomed by Awraba Berbers.
He made Fez his capital (founded 789), unified tribes, and introduced Shi'a-influenced governance. Poisoned (allegedly by Abbasid agent) in 791. His son, Idris II (born posthumously), consolidated the state.
The Idrisids ruled until 974, laying foundations for Moroccan identity, Fez's scholarly prominence, and the Sharifian lineage claimed by later dynasties (Saadi, Alaouite—current).