The Torah states: Do not go as a gossipmonger among your people (Vayikra 19:16). From the words among your people, our sages derive that is it forbidden to speak loshon hara about a Jew only when he is one who acts in the way of your people.
It is not shameful to focus on the shortcomings of a wicked person. The term “wicked person” refers to a malicious offender. However, one who since out of ignorance or temptation is in the category of amecha and it is forbidden to speak loshon hara about him (unless it is for a constructive purpose, as will be discussed later).
Sefer Chofetz Chaim, 14 Tishrei, page 76