The answer to your question "When is it okay to attack the police?" is always the same answer to, "When is it okay to attack a plumber, a gardener, a housekeeper...?
The best explanation I have ever heard regarding this topic was produced by @larkenrose.....