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:165

Why ˹is it that˺ when a ˹single˺ disaster struck you ˹on the day of Uhud˺, although you had struck ˹the enemy in the battle of Badr˺ with one twice as great, you said, "From where is this?" Say, "It is from yourselves." Indeed, Allah is over all things competent.  

And why, when distress befell you, at Uhud, when seventy of you were slain, and you had afflicted twice the like of it, at Badr, slaying seventy of them and taking another seventy captive, did you say, in amazement, ‘How is this?’, that is, how did this defeat happen to us when we are Muslims and God’s Messenger is among us (the last statement ˹annā hādhā, ‘how is this?’˺ constitutes ˹the locus of˺ the interrogative of denial). Say, to them: ‘It is from yourselves, because you abandoned your ˹battle˺ stations and were thus defeated. Surely God has power over everything’, including ˹the giving of˺ assistance and the withholding of it, and He requited you for your disputing ˹the Prophet’s command˺.
القرآن:٣:١٦٥

أَوَلَمَّا أَصَابَتْكُمْ مُصِيبَةٌ قَدْ أَصَبْتُمْ مِثْلَيْهَا قُلْتُمْ أَنَّىٰ هَٰذَا ۖ قُلْ هُوَ مِنْ عِنْدِ أَنْفُسِكُمْ ۗ إِنَّ اللَّهَ عَلَىٰ كُلِّ شَيْءٍ قَدِيرٌ  

{أولّما أصابتكم مصيبة} بأحد بقتل سبعين منكم {قد أصبتم مثليها} ببدر بقتل سبعين وأسر سبعين منهم {قلتم} متعجبين {أنَّى} من أين لنا {هذا} الخذلان ونحن مسلمون ورسولُ الله فينا والجملةُ الأخيرة محل للاستفهام الإنكارى {قل} لهم {هو من عند أنفسكم} لأنكم تركتم المركز فخُذلتم {إن الله على كل شيء قديرٌ} ومنه النصر وحده وقد جازاكم بخلافكم.