Important leaders and rulers include Idris I (Idris bin 'Abdallah, r.788–91), of the Umayyad dynasty, who came to Morocco and was able to consolidate much of the area. His son Idris II (r.791–804) founded Fès, the early capital. Yusuf bin Tashfin (r.1061–1106), a religious reformer, conquered much of Spain and northern Africa. Muhammad bin Tumart (1078?–1130) founded the Almohad sect and developed a democratic form of government. The founder of the Almohad dynasty, 'Abd al-Mumin bin 'Ali (1094?–1163), conquered Morocco and parts of Spain. Yakub al-Mansur (r.1184–99), who controlled all of North Africa west of Egypt, encouraged architecture and scholarship. Ahmad al-Mansur (r.1578–1603) drove all foreign forces out of Morocco, conquered the western Sudan, and established commercial and other contacts with England and Europe. Mawlay Isma'il (r.1672–1727) reunited Morocco and organized a harsh but effective centralized government. A capable and strong ruler famous for his justice was Muhammad bin 'Abdallah (r.1757–90). Morocco has attracted many great minds, and it has been said that none of the great names in western Arabic philosophy is unconnected with Morocco. Avicenna (Ibn Sina, or Abu 'Ali al-Husayn, 980?–1037), a great Persian physician and philosopher and an author of long-used textbooks on medicine, who was born near Bukhara, lived for a number of years in Morocco. So did Avenzoar (Ibn Zuhr, or Abu Marwan 'Abd al-Malik bin Abu-'l-'Ala' Zuhr, c.1090?–1162), physician and scholar, born in Sevilla, in Spain, and author of important medical treatises. Averroës (Ibn Rushd, or Abu al-Walid Muhammad ibn Ahmad ibn Rushd, 1126–98), greatest Arab philosopher of Spain, was born in Córdoba and lived in Morocco for many years. The doctor and philosopher Abubacer (Abu Bakr Muhammad bin 'Abd al-Malik bin Tufayl, d.1118) was likewise brought to the Moroccan court from Spain.
Among distinguished native-born Moroccans was Ahmad bin 'Ali al-Badawi (c.1200?–76), a Muslim saint who was active principally in Egypt. The great traveler Ibn Battutah (Abu 'Abdallah Muhammad bin Battutah, 1304–68?) visited and wrote about many countries of Africa, Asia, and Europe. The poetry of Muhammad bin Ibrahim (d.1955) is read throughout the Islamic world.
A famous fighter for Moroccan independence was 'Abd al-Karim (Muhammad 'Abd al-Karim al-Khattabi, 1882?–1963), who led a long campaign in the 1920s against French and Spanish forces. King Muhammad V (1909–61) gave up his throne as a gesture for independence, was arrested and exiled by the French, and returned in 1955 to become the first ruler of newly independent Morocco. He was succeeded by his son Hassan II (1929–1999), who continued his father's modernization program and expanded Morocco's territory and mineral resources by annexing Western Sahara. Mohamed VI (b.1964) became king following his father's death in 1999.