1,302. Those Who Were Executed
201:5 If a person was executed by order of the government or in some other situation, the relatives mourn for him even if he was an apostate. This is because, since he was killed by the hand of man and not through natural causes, it is considered an atonement for him.
201:6 If a person was a habitual sinner, even if he sinned only to satisfy his urges, if he did not recite the vidui (confession) before dying, he is not mourned. However if he recited the vidui, he is mourned, even if he was a criminal. [Again, this halacha does not reflect the entirety of the matter; consult your rabbi with questions of practical application.]