Idrisid dynasty
The founder of the Idrisid dynasty was Idris ibn Abdallah (788–791), who traced his ancestry back to Ali ibn Abi Talib (died 661) and his wife Fatimah, daughter of the Islamic prophet, Muhammad. He was the great grandchild of Hasan ibn Ali. After the Battle of Fakhkh, near Mecca, between the Abbasids and supporters of the descendants of the prophet Muhammad, Idris ibn Abdallah fled to the Maghreb. He first arrived in Tangier, the most important city of Morocco at the time, and by 788 he had settled in Volubilis (known as Walili in Arabic).