Prior to Napoleon's invasion in 1798, almost all of Egypt's educational, legal, public health, and social welfare issues were in the hands of religious functionaries. Ottoman rule reinforced the public and political roles of the ulama (religious scholars), as Mamluk rule had done before the Ottomans, because Islam was the state religion and because political divisions in the country were based on religious divisions. During the 19th and 20th centuries, successive governments made extensive efforts to limit the role of the ulama in public life and to bring religious institutions under closer state control.