The Messenger of Allah ﷺ said, "Our Lord marvels at a man who fought in the cause of Allah, and his companions were defeated. Knowing the consequence of fleeing, he turned back and fought until his blood was shed. Allah the Exalted then says to His angels, 'Look at My servant. He returned out of longing for what is with Me and out of fear of what is with Me, until his blood was shed.'"
قال رسول الله ﷺ: عجب ربنا من رجل غزا في سبيل الله فانهزم يعنى أصحابه، فعلم ما عليه، فرجع حتى أهريق دمه، فيقول الله تعالى لملائكته: انظروا إلى عبدي، رجع رغبة فيما عندي وشفقة مما عندي حتى أهريق دمه.
Abu Dawud (2536) narrated it, from Musa bin Ismail, who said, "Hammad narrated to us, Ata bin Saaib informed us, from Mura Hamdani, from Abdullah bin Masud," and he mentioned something similar. Its chain of transmission is sahih. Ata bin Saaib is trustworthy, and the leading scholars affirmed his reliability, except that his memory became confused toward the end of his life. However, Hammad bin Salama heard from him before this confusion set in. This is recorded in the Book of Faith, in the chapter on what has been reported concerning affirming amazement for Allah, the Exalted.