After four years of struggle, the Mahdist rebels overthrew the Ottoman-Egyptian administration and established their own "Islamic and national" government with its capital in Omdurman.
Mohammed Ahmed al-Mahdi enlisted the people of Sudan in what he declared a jihad against the administration that was based in Khartoum, which was dominated by Egyptians and Turks.
The Mahdi did not live long after this victory, and his successor Abdallahi ibn Muhammad consolidated the new state, with administrative and judiciary systems based on their interpretation of Islamic law.
[6] Muhammad Ahmad al-Mahdi declared all people who did not accept him as the awaited Mahdi to be infidels (kafir), ordered their killing and took their women and property.
Gordon's (and the general British) commitment to abolition squarely opposed the traditional Sudanese economy, which was coming to center on the slave trade now that ivory sources were being exhausted.
In this troubled atmosphere, Muhammad Ahmad ibn as Sayyid Abd Allah, who combined personal charisma with a religious and political mission, emerged, determined to expel the Turks and restore Islam to its original purity.
[14] Muhammad Ahmad's calls for an uprising found great appeal among the poorest communities along the Nile, as it combined a nationalist, anti-Egyptian agenda with fundamentalist religious certainty.
To avoid arrest, the Mahdi and a party of his followers, the Ansar, made a long march to Kurdufan, where he gained a large number of recruits, especially from the Baggara.
From a refuge in the area, he wrote appeals to the sheikhs of the religious orders and won active support or assurances of neutrality from all except the pro-Egyptian Khatmiyyah.
Merchants and Arab tribes that had depended on the slave trade responded as well, along with the Hadendoa Beja, who were rallied to the Mahdi by an Ansar captain, Osman Digna.
[15] The Mahdiyah equalized its male citizenry in totalitarian asceticism, mandating communal jibba; and firmly excluded women from all public space.
[17] Early in 1882, the Ansar, armed with spears and swords, overwhelmed a British-led 7,000-man Egyptian force not far from Al Ubayyid and seized their rifles, field guns and ammunition.
Baggara rebels under Rizeigat chief Madibo (Madibbu 'Ali) pledged themselves to the Mahdi and besieged Darfur's Governor-General Rudolf Carl von Slatin, an Austrian in the khedive's service, at Dara.
[21] The advance of the Ansar and the Hadendowa rising in the east imperiled communications with Egypt and threatened to cut off garrisons at Khartoum, Kassala, Sennar, and Suakin and in the south.
The Ansar had waited for the Nile flood to recede before attacking the poorly defended river approach to Khartoum in boats, slaughtering the garrison, killing Gordon, and delivering his head to the Mahdi's tent.
[23] The newly-captured wealth may have wrought a change in Mahdist standards of behavior: according to his enemies, "publicly [the Mahdi] continued to urge moderation on his followers, but in private he indulged in Turkish sensualities."
Justice was slow, as court decisions required his personal approval; and he continued to command his officers in the field even as he fell ill.[26] Six months after the capture of Khartoum, the Mahdi died, probably of typhus (22 June 1885).
[28] Nevertheless, the three caliphs, each supported by people of his native region, continued to jockey until 1891, when Abdallahi achieved unchallenged supremacy, with the help primarily of the Baqqara Arabs.
[31] Regional relations remained tense throughout much of the Mahdiyah period, largely because of the Khalifa's commitment to using jihad to extend his version of Islam throughout the world.
[15] Abd ar Rahman an Nujumi, the Khalifa's best general, invaded Egypt in 1889, but British-led Egyptian troops defeated the Ansar at Tushkah.
In preparation for the attack, the British established an army headquarters at the former rail head Wadi Halfa and extended and reinforced the perimeter defenses around Sawakin.
Despite taking the time to reconstruct Ishma'il Pasha's former 3 ft 6 in (1,067 mm) gauge railway south along the east bank of the Nile, Kitchener captured the former capital of Nubia by September.
[37] (The 3 ft 6 in (1,067 mm) gauge, hastily adopted to make use of available rolling stock, meant supplies from the Egyptian network required transshipment via steamer from Asyut to Wadi Halfa.
Anglo-Egyptian units fought a sharp action at Abu Hamad, but there was little other significant resistance until Kitchener reached Atbarah and defeated the Ansar.
Mopping-up operations required several years, but organized resistance ended when the Khalifa, who had escaped to Kordufan, died in fighting at Umm Diwaykarat in November 1899.
[citation needed] However, the Mahdi maintained that his movement was not a religious order that could be accepted or rejected at will, but that it was a universal regime, which challenged man to join or to be destroyed.
[44] The state's administration was first properly organized under Khalifa Abdallahi ibn Muhammad who attempted to use the Islamic law to unify the different peoples of Sudan.
[5] Ottoman vices, including snuff and alcohol (the latter forbidden in Islam) were all part of contemporary Sudanese culture; the Mahdist regime acted to strictly prohibit them.
[15] Abdallahi also authorized the burning of lists of pedigrees and books of law and theology because of their association with the old order and because he believed that the former accentuated tribalism at the expense of religious unity.
After the Mahdi's death, the command of the "Black Flag" was passed to Abdallahi ibn Muhammad's brother Yaqub and became the state's main army, based at the capital Omdurman.