[T]here are bound to be some people who judge you by what you write. In the end, it has to remain clear to you why you write what you write. In the case of mystery/crime writers, the reason is often to make sense of crime, to satisfy their own curiosity/concerns.
It tends to make news when killers are discovered to have read violent books, watched violent movies, or played violent video games. However, the very same material helps ease tension and safely release frustrations for many more people who don't make the news. These are good reasons to write about bad people.
Replying to another member on the same thread, I added:
A common criticism is, "Aren't you writers just giving potential killers and terrorists ideas?"
Along with keeping sight of our reasons for writing, we should remain clear which readers we want to reach. We aim not to inspire anyone to commit crime, but to reach readers who perceive the subtle morality play going on, who understand that—though they may have criminals for protagonists—crime stories on the whole condemn crime.