The Mughals were Muslims who ruled a country with a large Hindu majority. However for much of their empire the Mughals allowed Hindus to reach senior government or military positions.
Non-Muslims were not forced to obey Islamic law until Aurangzeb took power.