of pre-modern Islamic societies was largely defined by close-knit communities organized around kinship groups and local neighborhoods. Conflicts between individuals had the potential to escalate into a conflict between their supporting groups and disrupt the life of the entire community. Court litigation was seen as a last resort for cases where informal mediation had failed. This attitude was reflected in the legal maxim "amicable settlement is the best verdict" (al-sulh sayyid al-ahkam). In court disputes, qadis were generally less concerned with legal theory than with achieving an outcome that enabled the disputants to resume their previous social relationships. This could be accomplished by avoiding a total loss for the losing side or simply giving them a chance to articulate their position in public and obtain a measure of psychological vindication. Islamic law required judges to be familiar with local customs, and they exercised a number of other public functions in the community, including mediation and arbitration, supervision of public works, auditing waqf finances, and looking after the interests of orphans. Unlike pre-modern cultures where the ruling dynasty promulgated the law, Islamic law was formulated by religious scholars without involvement of the rulers. The law derived its authority not from political control, but rather from the collective doctrinal positions of the legal schools (madhhabs) in their capacity as interpreters of the scriptures. The ulema (religious scholars) were involved in management of communal affairs and acted as representatives of the Muslim population vis-à-vis the ruling dynasties, who before the modern era had limited capacity for direct governance. Military elites relied on the ulema for religious legitimation, with financial support for religious institutions being one of the principal means through which these elites established their legitimacy. In turn, the ulema depended on the support of the ruling elites for the continuing operation of religious institutions. Although the relationship between secular rulers and religious scholars underwent a number of shifts and transformations in different times and places, this mutual dependence characterized Islamic history until the start of the modern era. Additionally, since Sharia contained few provisions in several areas of public law, Muslim rulers were able to legislate various collections of economic, criminal and administrative laws outside the jurisdiction of Islamic jurists, the most famous of which is the qanun promulgated by Ottoman sultans beginning from the 15th century. The Mughal emperor Aurangzeb (r. 1658–1707) issued a hybrid body of law known as Fatawa-e-Alamgiri,