The Alter Rebbe dedicates a chapter to the spiritual danger of atzvut (sadness), explaining that even sadness over one's sins is a trap of the yetzer hara during actual avodah, and prescribes that one overcome sadness specifically in order to serve God — while setting aside a separate time to feel contrition.
בְּרַם, כְּגוֹן דָּא צָרִיךְ לְאוֹדוֹעֵי כְּלָל גָּדוֹל: כִּי כְּמוֹ שֶׁנִּצָּחוֹן לְנַצֵּחַ דָּבָר גַּשְׁמִי, כְּגוֹן: שְׁנֵי אֲנָשִׁים הַמִּתְאַבְּקִים זֶה עִם זֶה לְהַפִּיל זֶה אֶת זֶה, הִנֵּה, אִם הָאֶחָד הוּא בְּעַצְלוּת וּכְבֵדוּת – יְנוּצַּח בְּקַל וְיִפּוֹל גַּם אִם הוּא גִּבּוֹר יוֹתֵר מֵחֲבֵירוֹ, כָּכָה מַמָּשׁ בְּנִצְחוֹן הַיֵּצֶר, אִי אֶפְשָׁר לְנַצְּחוֹ בְּעַצְלוּת וּכְבֵדוּת – הַנִּמְשָׁכוֹת מֵעַצְבוּת וְטִמְטוּם הַלֵּב כָּאֶבֶן, כִּי אִם, בִּזְרִיזוּת – הַנִּמְשֶׁכֶת מִשִּׂמְחָה וּפְתִיחַת הַלֵּב, וְטָהֳרָתוֹ מִכָּל נִדְנוּד דְּאָגָה וָעֶצֶב בָּעוֹלָם. וּמִקְרָא מָלֵא דִּבֶּר הַכָּתוּב: ״תַּחַת אֲשֶׁר לֹא עָבַדְתָּ אֶת ה׳ אֱלֹהֶיךָ בְּשִׂמְחָה וְגוֹ׳״, וְנוֹדָע לַכֹּל פֵּירוּשׁ הָאֲרִ״י זִכְרוֹנוֹ לִבְרָכָה עַל פָּסוּק זֶה: וְהִנֵּה, בֵּין שֶׁנָּפְלָה לוֹ הָעַצְבוּת בִּשְׁעַת עֲבוֹדָה בְּתַלְמוּד תּוֹרָה אוֹ בִּתְפִלָּה, וּבֵין שֶׁנָּפְלָה לוֹ שֶׁלֹּא בִּשְׁעַת עֲבוֹדָה, זֹאת יָשִׂים אֶל לִבּוֹ: כִּי אֵין הַזְּמַן גְּרָמָא כָּעֵת לְעַצְבוּת אֲמִיתִּית, אֲפִילוּ לְדַאֲגַת עֲוֹנוֹת חֲמוּרִים חַס וְשָׁלוֹם, רַק לָזֹאת צָרִיךְ קְבִיעוּת עִתִּים וּשְׁעַת הַכּוֹשֶׁר בְּיִשּׁוּב הַדַּעַת, לְהִתְבּוֹנֵן בִּגְדוּלַּת ה׳ אֲשֶׁר חָטָא לוֹ, כְּדֵי שֶׁעַל יְדֵי זֶה יִהְיֶה לִבּוֹ נִשְׁבָּר בֶּאֱמֶת בִּמְרִירוּת אֲמִיתִּית.
Truly this should be made known as a cardinal principle, that as with a victory over a physical obstacle, such as in the case of two individuals who are wrestling with each other, each striving to throw the other—if one is lazy and sluggish he will easily be defeated and thrown, even though he be stronger than the other, exactly so is it in the conquest of one’s evil nature; it is impossible to conquer it with laziness and heaviness, which originate in sadness and in a heart that is dulled like a stone, but rather with alacrity which derives from joy and from a heart that is free and cleansed from any trace of worry and sadness in the world. Furthermore, Scripture states it explicitly: “Because you did not serve the L–rd your G–d with joyfulness…”—and everyone is familiar with the commentary of the Arizal on this verse. Thus, whether the melancholy encroaches on him during Divine service, in study or prayer, or not during Divine service, he should tell himself that now is not the time for genuine anxiety, not even for worry over serious transgressions, G–d forbid. For, for this, one needs appointed times and a propitious occasion, with calmness of mind to reflect on the greatness of G–d, against Whom one has sinned, so that thereby one’s heart may truly be rent with sincere contrition.