A man came to the Prophet ﷺ and asked, "Which of the people is the best?"He replied, "A man who strives in the cause of Allah with his life and his wealth."The man asked, "Then who?"He said, "Then a man secluded in a mountain pass, worshipping Allah and sparing people from his harm."
حدثنا هشام بن عمار حدثنا يحيى بن حمزة حدثنا الزبيدي حدثني الزهري عن عطاء بن يزيد الليثي
أن رجلا أتى النبي ﷺ فقال أي الناس أفضل قال رجل مجاهد في سبيل الله بنفسه وماله قال ثم من قال ثم امرؤ في شعب من الشعاب يعبد الله عز وجل ويدع الناس من شره
Bukhari narrated it in the Book of Softening of Hearts, Chapter on solitude being a relief from bad company, hadith no. 6494, from the hadith of Zuhri through him, and Muslim narrated it in the Book of Leadership, in the aforementioned chapter, hadith no. 1888, from the hadith of Yahya bin Hamza through him.