body: As I was explained in another question in this SE community, prosecutors dont have the resources to prosecute every single crime [Does a prosecutor have any legal resource..](https://law.stackexchange.com/questions/23984/does-a-prosecutor-have-any-legal-resource-to-avoid-aplying-a-law-which-is-uncons)
  
  
  Then, what does it prevent a state to prosecute people discriminatorily as it might and it indeed happens in certain countries (based in race, sex, political affiliation, etc)? Is there any legal mechanism in any country, that prevents a state to apply laws discriminatorily?
  
  
  
title: Is there any legal mechanism in any country, that prevents a state to apply laws discriminatorily?