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:8:57

So if you, ˹O Muhammad˺, gain dominance over them in war, disperse by ˹means of˺ them those behind them that perhaps they will be reminded.  

So if (fa-immā: here the letter nūn of the conditional particle in, ‘if’, has been assimilated with the extra mā) you come upon them, ˹if˺ you find them, anywhere in the war, ˹deal with them so as to˺ cause those, fighters, behind them to scatter, to disperse, by making an example of them and punishing them, so that they, the ones behind them, might remember, ˹that they might˺ take heed from their example.
القرآن:٨:٥٧

فَإِمَّا تَثْقَفَنَّهُمْ فِي الْحَرْبِ فَشَرِّدْ بِهِمْ مَنْ خَلْفَهُمْ لَعَلَّهُمْ يَذَّكَّرُونَ  

{فإما} فيه إدغام نون إن الشرطية في ما المزيدة {تثقفنَّهم} تجدنهم {في الحرب فشرِّد} فرق {بهم من خلفهم} من المحاربين بالتنكيل بهم والعقوبة {لعلَّهم} أي الذين خلفهم {يذَّكرون} يتعظون بهم.