Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:3:139

So do not weaken and do not grieve, and you will be superior if you are ˹true˺ believers.  

Faint not, shrink ˹not˺ from fighting the disbelievers, neither grieve, for what befell you at Uhud, for you shall prevail, through victory over them, if you are, truly, believers. (the response to this ˹last conditional clause˺ is the sum ˹meaning˺ of what has preceded it).
القرآن:٣:١٣٩

وَلَا تَهِنُوا وَلَا تَحْزَنُوا وَأَنْتُمُ الْأَعْلَوْنَ إِنْ كُنْتُمْ مُؤْمِنِينَ  

{ولا تهنوا} تضعفوا عن قتال الكفار {ولا تحزنوا} على ما أصابكم بأحد {وأنتم الأعلون} بالغلبة عليهم {إن كنتم مؤمنين} حقا وجوابه دل عليه مجموع ما قبله.