The Ottomans re-established direct control over Tripolitania and Cyrenaica after 1835 by a mixture of conquest, punitive taxation, and the incorporation of local leaders into provincial government. Resistance centred on Jebel al-Ghar, in Misrata, among the Warfalla and Tarhuna tribes, and in Fezzan. Eventually it was crushed, but even then, direct Ottoman control was confined to the coast around Tripoli city and eastwards towards Misrata. The towns were factionalized, and the Ottomans tried to incorporate the leaders of the main families into their administration.
Ottoman control over the coast had two effects. It increased the penetration of capital into the interior, so that trade flourished and the foundations of a bureaucratic state were laid in Tripolitania;
There was local government in Tripoli and other towns. Formal primary and secondary education and the beginnings of a civilian legal system grew up, and a limited infrastructure developed. By the end of the 19th century Tripoli was a large town of about 30,000 people, and the rural population in its hinterland was becoming sedentary. The basis of a modern educated class emerged from the old elite families.
The Ottoman authorities had far less influence in Cyrenaica, which was effectively the fiefdom of a powerful Sufi brotherhood, the Senussi. It was founded by Sayyid Muhammad ibn Ali al-Senussi (1787-1859) in Mecca in 1837. He preached a middle path between the ecstatic and intuitive ways of Sufi mystics and the rationality of orthodox Sunni ulama (religious scholars), rejecting fanaticism and the use of stimulants and living on charity. He emphasized the benefits of hard work and that members must earn their living. The order became extremely wealthy by taking control of the caravan trade across the Sahara.
By 1843 the Grand Senussi moved his headquarters to Sidi Rafaa (which was renamed Bayda, after the zawiya al-bayda, its white monastery) in the Jabal al-Akhdar district in Cyrenaica, with the intention of promoting his teachings and bringing education and knowledge of Islam to rural areas. The austerity of his message matched the local tribes’ character. In 1855 he moved his base again, this time to Jaghbub, close to the Egyptian oasis of Siwa but still in present-day Libya.
The Senussi brotherhood was famous in Fez, Damascus, Constantinople, the Hejaz, and as far away as India. When the Grand Senussi died, in 1859, his son Muhammad al-Mahdi succeeded him. In Cyrenaica and the desert, the brotherhood was more powerful than the nominal governors of the Ottomans. These were remote areas, to which the brotherhood resorted in order to be far from Ottoman influence. In 1894 the Grand Senussi’s son, al-Mahdi, moved his base even further away, to Kufra, far to the south. The hundred or so local Senussi zawiyas (retreats) scattered across the desert and both its fringes, performed some of the functions that a centralized state might otherwise have provided. They offered mediation in disputes, assistance to the poor, encouragement of trade, and resistance to the encroaching armies of the Christian powers. When the French began their advance across the Sahara at the beginning of the 20th century, the Senussi organized a jihad to resist them.