From 1885 to 1898 it was ruled, de facto, by the Mahdi and his successor the Khalifa (literally 'Successor'). Following the defeat of the Mahdists at the Battle of Omdurman, the Sudan was reorganised as an Anglo-Egyptian Condominium. The Head of the Egyptian Army was the Governor-General and there was still a large garrison, as the territory was huge and the remoter parts, such as Darfur, were not pacified until 1916.