He reported that he said, "Messenger of Allah, what do you think if I meet a man from the disbelievers and he fights me, striking off one of my hands with the sword, and then he takes refuge from me behind a tree and says, 'I have submitted to Allah,' should I kill him, Messenger of Allah, after he has said that?"The Messenger of Allah ﷺ replied, "Do not kill him."I said, "Messenger of Allah, but he cut off my hand."The Messenger of Allah ﷺ said, "Do not kill him. If you kill him, he is in the position you were in before you killed him, and you are in the position he was in before he spoke the words he spoke."
حدثنا قتيبة بن سعيد عن الليث عن ابن شهاب عن عطاء بن يزيد الليثي عن عبيد الله بن عدي بن الخيار
أنه أخبره أنه قال يا رسول الله أرأيت إن لقيت رجلا من الكفار فقاتلني فضرب إحدى يدي بالسيف ثم لاذ مني بشجرة فقال أسلمت لله أفأقتله يا رسول الله بعد أن قالها قال رسول الله ﷺ لا تقتله فقلت يا رسول الله إنه قطع يدي قال رسول الله ﷺ لا تقتله فإن قتلته فإنه بمنزلتك قبل أن تقتله وأنت بمنزلته قبل أن يقول كلمته التي قال
Reported by Muslim, in the Book of Faith, chapter on the prohibition of killing a disbeliever after he says "There is no god but Allah," hadith 95, from Qutayba. Also by Bukhari, in the Book of Blood Money, chapter on Allah's statement, "Whoever kills a believer intentionally, his recompense is Hell," hadith 6869, from the hadith of Ibn Shihab Zuhri, with the same wording.