A person acting or purporting to act in an official capacity or taking advantage of such actual or purported capacity commits a misdemeanor if, knowing that his or her conduct is illegal, he or she:
(a) Subjects another to arrest, detention, search, seizure, mistreatment, dispossession, assessment, lien or other infringement of personal or property rights; or
(b) Denies or impedes another in the exercise or enjoyment of any right, privilege, power or immunity.