Programming AI to...
Why not program the AI to "Maximize the liberty of every individual"? That way, the AI can't enslave anyone and it's job is to give us choices. If it follows contractarian philosophical principles, then it would not even be terribly difficult for it to deal with criminality in a moral/ethical manner.