Classical jurisprudence was elaborated by private religious scholars, largely through legal opinions (fatwas) issued by qualified jurists (muftis). It was historically applied in Sharia courts by ruler-appointed judges, who dealt mainly with civil disputes and community affairs. Sultanic courts, the police and market inspectors administered criminal justice, which was influenced by Sharia but not bound by its rules. Non-Muslim (dhimmi) communities had legal autonomy to adjudicate their internal affairs. Over the centuries, Sunni Islam muftis were gradually incorporated into state bureaucracies, and fiqh was complemented by various economic, criminal and administrative laws issued by Muslim rulers. The Ottoman civil code of 1869–1876 was the first partial attempt to codify Sharia.