Ahmed ibn Abi Mahalli

Ahmed ibn Abi Mahalli (ابن أبي محلي; 1560–1613), born in Sijilmasa, was a Moroccan Imam and the Sufi leader of a revolt (1610–13) against the reigning Saadi Sultan Zidan Abu Maali in the south of Morocco in which Ibn Abi Mahalli proclaimed himself Mahdi. He occupied the Saadi's southern capital Marrakesh in 1612 until his death.

Biography
Born to a family of scholars, Ibn Abi Mahalli was trained in Fez by Sufi masters. In his early years, his teacher was Sidi Ahmed ben Aboulqacem Essoumai Ettadeli. As young teenager he went to Fez to finish his studies which lasted for 4 to 5 years. Then he went to Adjedzihara (countryside around Fez) and completed his Risala (Treaty of Law). In completing his theology education, during 18 years Ibn Abi Mahalli then became disciple of Abou Abdallah Sidi Mohammed ben Mobarek Ezzaeri, sheikh of his zaouia (institution). In the early 1590s, his master assigned him to Sijilmasa, to remain there, and gifted his disciple his stick, his burnous, and his shoes; as well as upon farewell handing him a hat and putting it on Ibn Abi Mahalli's head as a religious symbol. Al-Yusi recounts in the Al-Muhāharāt, his best known text, that: "'Abu Mahalli had followed the path laid out for him by Ibn Mobarek Ezzaeri and had come to possess grace to a certain degree. He composed treatises on this subject which prove that so was the case, and it was only later that he felt his ambitious ideas spring up within him'."Ibn Abi Mahalli then became "one of the closest disciples" of a revered holy man, Abd al-Qadir Abi Samha, aka Sidi Sheikh. In 1602, Ibn Abi Mahalli broke with Sidi Sheikh, accusing him of being an imposter (dajjal) who had made innovations in doctrine. He also drew an "apocalyptic picture" of Christianity" and denounced the ruling Saadi dynasty for alleged passivity in the face of the Spanish unbelievers. After the surrender of Larache to the Spanish in 1610, Ibn Abu Mahalli saw a loss of legitimacy from the Saadians and became determined of their failure to protect the people against a foreign nation of unbelievers. He also denounced a loosening of faith in Morocco and seized the opportunity and proclaimed himself Mahdi at his birthplace of Sijilmasa in 1612. Despite few adherents initially, his generally assumed baraka was so great that soon enough it was sufficient to defeat Saadi troops and conquer Tafilalt and Draa after which he marched on to Marrakesh. His party now numerically strengthened, he attacked the capital of Marrakesh and opened its gates, but the Saadi forces of Sultan Zidan Abu Maali came after him and their attack was "unrelenting and merciless". Nevertheless Ibn Abi Mahalli was victorious at the battle, while Zidan Abu Maali was forced to flee westward to Safi.

Ibn Abi Mahalli occupied the capital thus entering and installing himself as master in the Imperial El Badi Palace. There he married Dowager Princess Lalla Aisha bint Abu Bakkar al-Shabani mother of Zidan Abu Maali, consumed his marriage with her and a son was born of their union. Sultan Zidan was able to overcome Ibn Abu Mahalli only with much difficulty and resolved to ask assistance from Abu Zakaria Yahya ben Abdallah el-Daouidi, a military leader living in his father's zaouia in the High Atlas mountains.

Yahya ben Abdallah responded to the call and with numerous contingents of musketeers descended to Marrakesh, arriving near the capital on 22 October 1613. Ibn Abi Mahalli went to meet Yahya's troops in combat, but was killed in the outbreak of the fight by a bullet in the chest from which he immediately succumbed. After he was killed in combat Ibn Abi Mahalli's followers saw "their faith in his invincibility disproven", and fled. His head was severed and hung from the city ramparts for 12 years, along with those of his army's principal chiefs, until it disintegrated. Ibn Abi Mahalli's head was afterwards buried in the Mausoleum of the Saint (wali in Arabic) Abou el-Abbas el-Sebti in Marrakesh.

Zaydani Library
Ibn Abi Mahalli's revolt forced Zidan Abu Maali to flee Marrakesh for Agadir. During this move, the Zaydani Library of manuscripts was lost to Spanish privateers, and eventually made its way to El Escorial Monastery, where it remains.

Works
He is the author of many books of which only six remain today. Among those are l'Islit al-khirrit (also spelled al-Aslit), Al Salsabil and Miharas.
 * Islit Al-Khirit Fi Kalie Bouloume Al-Ifrit A'Nnefrit (en إصليت الخريت في قطع بلعوم العفريت النفريت)
 * El-Haoudadj (الهودج)
 * Al-Kostas El-Mostakim Fi Maarifat A'sahih Mina A'sakim (القسطاس المستقيم في معرفة الصحيح من السقيم)
 * El Ouaddah (الوضاح)
 * Manjanik Sokhor Lihadmi Binaa Cheikh El Ghoror Ou'Rass El-Fodjor (منجنيق الصخور لهدم بناء شيخ الغرور ورأس الفجور)
 * Jaouab El-Kharoubi (جواب الخروبي)