non-muslim communities living under islamic rule were allowed to follow their own laws. the government kept out of their internal legal affairs, except when there was a dispute between people of different religions. such cases were handled by a qadi. when that happened, sharia rules gave muslims some legal advantages over non-muslims. however, non-muslims often won cases against muslims and even against high government officials, because people thought that sharia was a reflection of divine justice which should defend the weak against the powerful.