information:classification
First invasion of Egypt

The first expedition against Egypt was launched on 24 January 914, led by Habasa ibn Yusuf. Advancing along the coast, on 6 February it entered Barqa, the capital of Cyrenaica. There Habasa executed two chieftains of the Mazata tribe, who nine years before had waylaid and robbed al-Mahdi during his journey to Ifriqiya; their sons were also killed, and their womenfolk sold into slavery and their possessions confiscated. Encouraged by this success, on 11 July al-Mahdi sent al-Qa'im with another army east to assume command of the expedition. Disregarding these orders, however, the ambitious Habasa led his forces into Egypt, entering Alexandria on 27 August.

The news of the Fatimid invasion threw Baghdad into a panic. The Abbasid government had paid little attention to the affairs of Ifriqiya and the claims of al-Mahdi—al-Tabari refers to him vaguely as al-Khariji ('the Kharijite ') or Ibn al-Basri ('Son of the Basran') —but now urgent inquiries were made as to his origin and intentions. The Fatimid campaign in Egypt ultimately failed. The attempts to cross the Nile at Giza and capture Fustat were beaten back, and reinforcements arrived from Syria under Mu'nis al-Muzaffar in April 915, greatly shoring up the Abbasid position in the country. The Fatimid army was also plagued by indiscipline and a divided command, as al-Qa'im fell out with Habasa. The latter eventually deserted the campaign and returned to Ifriqiya. Alarmed by this, al-Qa'im evacuated Alexandria hastily and without battle, leaving much of his armament and equipment behind, returning to Raqqada in 28 May 915. In his rear, Cyrenaica rose in revolt and overthrew Fatimid control; in Barqa, the entire Kutama garrison was killed.

The expedition's failure rocked the Fatimid regime's very foundation and the belief in the divine mission of the imam-caliph was shaken. As a result, discontent arose, particularly among the Kutama sub-tribe of the Malusa, from whom Habasa, now hounded as a criminal, originated. His eventual capture and imprisonment led to the revolt of his brother Ghazwiyya, who had played a crucial role in securing al-Mahdi's regime up to that point, and who had recently been given charge of the entire Kutama country to the west of Ifriqiya. The revolt was quickly crushed, however, and Ghazwiyya and Habasa were executed. When their heads were brought before al-Mahdi, he is said to have exclaimed "Once did these heads enclose the East and West; and now they are contained within this basket!".