Narrated Abdullah ibn Mas’ud (R.A): The Prophet (peace be upon him) said: Our Lord Most High is pleased with a man who fights in the path of Allah, the Exalted; then his companions fled away (i.e. retreated). But he knew that it was a sin (to flee away from the battlefield), so he returned, and his blood was shed. Thereupon Allah, the Exalted, says to His angels: Look at My servant; he returned seeking what I have for him (i.e. the reward), and fearing (the punishment) I have, until his blood was shed.
Sunan Abi Dawud, Book 15, Hadith 60