Moulay Ismail Ibn Sharif (Arabic: أبو النَّصْرِ مولاي إسماعيل بن الشريف, romanized: Abu 'l-Naṣr Mawlāy Ismāʿīl ibn al-Sharīf, c. 1645 – 22 March 1727) was a Sultan of Morocco from 1672 to 1727, as the second ruler of the 'Alawi dynasty. He was the seventh son of Moulay Sharif and was governor of the province of Fez and the north of Morocco from 1667 until the death of his half-brother, Sultan Moulay Rashid in 1672. He was proclaimed sultan at Fez, but spent several years in conflict with his nephew Moulay Ahmed ben Mehrez, who also claimed the throne, until the latter's death in 1687. Moulay Ismail's 55-year reign is the longest of any sultan of Morocco. During his lifetime, Isma'il amassed a harem of over 500 women with more than 800 confirmed biological children, making him one of the most prodigious fathers in recorded history.
The reign of Moulay Ismail marked a high watermark for Moroccan power. His military successes are explained by the creation of a strong army, originally relying on the 'Guichs' (especially the Udaya) and on the Black Guard (or Abid al-Bukhari), black slaves who were totally devoted to him. As a result, the central power could be less reliant on tribes that often rebelled. Moulay Ismail failed against the Ottoman Regency of Algiers during the Battle of Moulouya in 1692, as he tried to expand his territory towards Tlemcen. Moulay Ismail once again attempted to capture Oran, which was under Spanish rule, he had some success in pushing back the tribes of the Regency of Algiers until the Algerian Bey Mustapha cooperated with the Spaniards in pushing back Moulay Ismail's army. Moulay Ismail engaged in the Maghrebi War against the Regency of Algiers, he was successful in conquering the Western Beylik, he even looted the palace of the Bey. His army was subsequently pushed back in the Battle of Chelif in 1701. He participated in other minor battles such as Laghouat in 1708 which ended successfully. He expelled the Europeans from the ports they had occupied: Larache, Asilah, Mehdya, and Tangier. He took thousands of Christians prisoner and nearly took Ceuta.