The Supreme Court has said that qualified immunity protects “all but the plainly incompetent or those who knowingly violate the law.”
I am wondering how the courts define "plain incompetence". Is it up to the judge, or does the qualified incompetence have to meet certain strict criteria in order to be determined to be so by the court? When does qualified immunity fail and allow an official to be prosecuted? Assume that the country is the U.S.