Telling a Mitzva From an Aveira
TefillahTeshuvahSimcha
In Tehillim 119, Dovid HaMelech says, “I am Your servant; teach me to understand Your testimonies,” and asks Hashem for help in telling mitzvos from aveiros. The Kol Arye explains the difficulty. A person is sometimes unsure whether an act is a mitzva or an aveira, and the Tefilla LeMoshe says that if he feels desire and joy in it, he can assume it is a transgression, because most people do not feel as much passion in mitzvos as they do in sin. Great tzaddikim, however, do feel passion and joy in mitzvos, so the test fails them, since their desire for a mitzva may equal or exceed their desire for an aveira. This was Dovid HaMelech's request when he said, “I love Your mitzvos more than gold.” Sometimes “it is a time to act for Hashem, they have abrogated Your Torah,” and a mitzva comes disguised as a transgression, as in an aveira lishma, a sin done sincerely for a good end. He asks Hashem to help him understand the difference.
Source: Kol Arye al HaTorah, Likkutim (Tiyul Bapardes 8:1), on Tehillim 119