The Torah states: Do not go as a gossipmonger among your people (Vayikra 19:16). From the word among your people, our Sages derive that it is forbidden to speak loshon hora 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 sins out of ignorance or temptation is in the category of amecha and it is forbidden to speak loshon hora about him (unless it is for a constructive purpose, as will be discussed later).