Qualified Immunity says that an officer can't be sued for violating civil rights (Section 1983) unless it was clear at the time of the action that it was in violation of the law. It has nothing to do with criminal liability in the event the officer commits a crime; it's a restriction on the civil side.
There is a grain of good policy here, becuase if there is a lawsuit which plantiff is inevitably going to lose, having a clear rule that stops the lawsuit before discovery saves serious time and money.
There are two independent problems with it, though:
1. A judge who just doesn't like 1983 lawsuits can always find a trivial manner to distinguish the case from existing precedent; e.g. distinctions-without-differences like "the court has ruled you can't detain someone for 72 hours without access to water but the plantiff was only detained for 70."
2. There is no incentive for anyone to be the first mover to file a lawsuit against any particular practice since the first mover will lose on qualified immunity grounds.
So are there any good counterexamples of it being used in a beneficial way?