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:5:34

Except for those who return ˹repenting˺ before you apprehend them. And know that Allah is Forgiving and Merciful.  

Except for such, warmongers and waylayers, as repent before you overpower them; for know that God is Forgiving, to them of what they have done, Merciful, to them. This ˹proviso˺ is expressed without any statement to the effect ‘do not submit them to prescribed legal punishment’, to point out that when such a person repents only God’s prescribed punishments (hudūd) — and not those deriving from the rights of human beings — are waived. This is how I see it. I do not know of any that have tackled this ˹topic˺, and God knows best. If, then, a person has killed and stolen property, he should be killed and have his limbs cut off ˹on opposite sides˺, but not crucified — this is the more sound of two opinions held by al-Shāfi‘ī. However, his repentance is of no avail, once he has been overpowered ˹by the authorities˺ — this is also the more sound of two opinions held by him.
القرآن:٥:٣٤

إِلَّا الَّذِينَ تَابُوا مِنْ قَبْلِ أَنْ تَقْدِرُوا عَلَيْهِمْ ۖ فَاعْلَمُوا أَنَّ اللَّهَ غَفُورٌ رَحِيمٌ  

{إلا الذين تابوا} من المحاربين والقطَّاع {من قبل أن تقدروا عليهم فاعلموا أن الله غفور} لهم ما أتوه {رحيم} بهم عبر بذلك دون فلا تحدوهم ليفيد أنه لا يسقط عنه بتوبته إلا حدود الله دون حقوق الآدميين كذا ظهر لي ولم أرَ من تعرض له والله أعلم فإذا قتل وأخذ المال يقتل ويقطع ولا يصلب وهو أصح قولي الشافعي ولا تفيد توبته بعد القدرة عليه شيئا وهو أصح قولي الشافعي ولا تفيد توبته بعد القدرة عليه شيئا وهو أصح قوليه أيضا.