I don't think it's due to malice at all. To my mind that's not how most human brains work (except abnormal or anti-social personality types).
But, people are often willing to do things that they know are wrong or harmful as long as it serves some kind of greater good in their mind. That's the case with the drug war IMO and law enforcement's actions. Over the decades they've been fed a non-stop diet of propaganda about how evil drugs are, how the drugs are the root cause of all the misery and destitution that they may or may not see on the streets (depending on where their jurisdiction is), etc.
Just take the issue of lying. We all know that telling lies is something that you should typically avoid, especially if doing so will cause harm to another person. Cops know this too, but they lie their asses off all the time! They'll get up on the stand and lie without a second thought if it's just their word against some defendant's.
I'm reminded of this every time I look through the police blotter in my local newspaper. Incredibly, nearly every incident report of a narcotics possession bust is reported the same way: the drugs in question fell out of the defendants wallet during their interaction with law enforcement. Yes, fell out of their wallet! Like oh yeah officer here's my insurance card....whoopsee daisy! Goddamn those pesky droogas, always falling out of my wallet!
Whereas in reality we all know what happened: the cop rummaged through the individual's pockets and/or personal effects until they found drugs, then changed the sequence of events so it'd play out better in court. And who you gonna believe, some druggie or the honorable officer Paul Blart who's served with distinction on the force trying to rid the streets of these dastardly drugs? It's so dumb (and extremely corrosive to a healthy, functioning civil society) but people over the decades have been so enamored with this distant recreational drug-free utopia that they're willing to commit very morally transgressive acts to get there