In Tehillim 119 Dovid HaMelech says, “I am Your servant; teach me to understand Your testimonies. For it is a time to act for Hashem; they have abrogated Your Torah. Therefore I loved Your mitzvos more than gold...”
The Kol Arye explains that Dovid HaMelech is asking for Hashem’s help in distinguishing between mitzvos and aveiros:
Sometimes a person is in doubt regarding a certain act he wants to do – is it a mitzva or not? Perhaps it is an aveira? How should he make a decision? How can he know whether to do it or not?
The Tefilla LeMoshe says that if a person feels a desire and joy in that act, he can assume it is a transgression, because for most people there is not as much desire, passion and joy in the performance of mitzvos as there is in sin. However, regarding great Tzaddikim, they do have such a passion and joy in performing mitzvos. If so, the Tzaddikim have a problem: how can they tell whether the act they wish to peform is a mitzva or a transgression? The standard litmus test of passion, desire and joy does not work for them, since they might have equal or greater passion, desire and joy to do a mitzva as an aveira?!
This what Dovid HaMelech meant when he said this pasuk [he was an example of someone who could not distinguish between mitzvos and aveiros due to his great desire, passion and joy]. “I am Your servant; let me know and understand Your testimony” – is it a mitzva or an aveira? Sometimes “it is a time to act for Hashem and the Torah is abrogated,” and sometimes it is a mitzva disguised as a transgression, such as an aveira lishma – a sin done sincerely as means to a positive end. If there is a way to tell the difference, a litmus test or some sign to know whether in fact this act is a mitzva or not, by observing if he has