1906, armed resistance to British rule had ended. Administrative structure The Sokoto state was largely organized around a number of largely independent emirates pledging allegiance to the sultan of Sokoto. The administration was initially built to follow those of Muhammad during his time in Medina, but also the theories of Al-Mawardi in "The Ordinances of Government". The Hausa kingdoms prior to Usman dan Fodio had been run largely through hereditary succession. The early rulers of Sokoto, dan Fodio and Bello, abolished systems of hereditary succession, preferring leaders to be appointed by virtue of their Islamic scholarship and moral standing. Emirs were appointed by the sultan; they traveled yearly to pledge allegiance and deliver taxes in the form of crops, cowry shells, and slaves. When a sultan died or retired from the office, an appointment council made up of the emirs would select a replacement. Direct lines of succession were largely not followed, although each sultan claimed direct descent from dan Fodio. The caliphate absorbed many of the structures of governments of their Hausa predecessors which they had conquered. It ruled under Islamic law with powers falling to the emirates which made up the caliphate. A large number of emirs and senior officials were Fulani clerics and scholars who participated in the Fulani War. The major administrative division was between Sokoto and the Gwandu Emirate. In 1815, Usman dan Fodio retired from the administrative business of the state and divided the area taken over during the Fulani War with his brother Abdullahi dan Fodio ruling in the west with the Gwandu Emirate and his son Muhammed Bello taking over administration of the Sokoto Sultanate. The Emir at Gwandu retained allegiance to the Sokoto Sultanate and spiritual guidance from the sultan, but the emir managed the separate emirates under his supervision independently from the sultan. The administrative structure of loose allegiances of the emirates to the sultan did not always function smoothly. There was a series of revolutions by the Hausa aristocracy in 1816–1817 during the reign of Muhammed Bello, but the sultan ended these by granting the leaders titles to land. There were multiple crises that arose during the 19th century between the Sokoto Sultanate and many of the subservient emirates: notably, the Adamawa Emirate and the Kano Emirate. A serious revolt occurred in 1836 in the city-state of Gobir, which was crushed by Muhammed Bello at the Battle of Gawakuke.