Sahih Muslim Book 20, Hadith Number 4653.

Chapter : Merit of Jihad and of keeping vigilance (over the enemy).

It has been narrated (through a different chain of transmitters) on the same authority (i.e. Abu Sa’id Khadri) who said: A man asked: Messenger of Allah, which of men is the best? He said: A believer who fights staking his life and spending his wealth in the way of Allah. He asked: Who is next to him (in excellence)? He said: Next to him is a man who lives an isolated life in a mountain gorge, worshipping his Lord and sparing men from his mischief.