Emperor Yohannes IV was crowned in January 1872, and not long after this, the Egyptians had began an expansion from the north of Ethiopia and extending it towards the city of Harar. By 1875 the Ethiopians had inflicted heavy losses onto the invading Egyptian army. Meanwhile, the Mahidists were attacking to the west and were attempting to reach the city of Gojam.
As the Emperor was heavily engaged with the Egyptians, the Prince Tekle Haimanot of Gojam took up an army and fought the Sudanese Mahadists. He would be joined by King Menelik. In time and against the advise of his counselors, Emperor Yohannes joined the fight against the Mahidists. He went to battle leading the charge and was shot twice. The Mahadists decapitated him and took his remains to the Sudan. After expelling the Mahidists from Ethiopia, King Menilik became Emperor and demanded a proper burial for Yohannes IV and was obliged.
In 1898, in the context of the scramble for Africa, the British decided to reassert Egypt's claim on Sudan. An expedition, commanded by Kitchener, was organised in Egypt. It was composed of 8,200 British soldiers and 17,600 Egyptian and Sudanese soldiers commanded by British officers. The Mahdist forces (sometimes called the Dervishes) were more numerous, numbering more than 60,000 warriors, but lacked modern weapons.
After defeating a Mahdist force in the Battle of Atbara in April 1898, the Anglo-Egyptians reached Omdurman, the Mahdist capital in September. The bulk of the Mahdist army attacked, but was cut down by British machine-guns and rifle fire. The remnant, with the Khalifa Abdullah, fled to southern Sudan. They finally caught up with Abdullah at Umm Diwaykarat, where he was killed, effectively ending the Mahdist regime.