The Book of Miscellany
كتاب المقدمات
(69) Chapter: Desirability of Seclusion at times of corruption committed by the people of the World
(69) - باب استحباب العزلة عند فساد الناس والزمان أو الخوف من فتنة فى الدين ووقوع فى حرام وشبهات ونحوها
Riyad as-Salihin 597 
Abu Sa'id Al-Khudri (May Allah be pleased with him) reported:
Someone asked Messenger of Allah (ﷺ): "Who is the best man?" He (ﷺ) answered, "A believer who strives in the Cause of Allah with his life and his wealth." The man asked: "Who is the next?" He said, "One who retires into a narrow valley and worships his Rubb."

Another narration is: Messenger of Allah (ﷺ) said, "One who fears Allah and safeguards people against his own mischief."

[Al-Bukhari and Muslim].

وعن أبي سعيد الخدرى رضي الله عنه قال‏:‏ قال رجل‏:‏ أى الناس أفضل يا رسول الله‏؟‏ قال‏:‏ ‏"‏مؤمن مجاهد بنفسه وماله فى سبيل الله‏"‏ قال‏:‏ ثم من‏؟‏ قال‏:‏ ‏"‏ رجل معتزل فى شعب من الشعاب يعبد ربه‏"‏

وفى رواية‏:‏ ‏"‏يتقي الله، ويدع الناس من شره‏"‏ ‏(‏‏(‏متفق عليه‏)‏‏)‏‏.‏

Reference : Riyad as-Salihin 597
In-book reference : Introduction, Hadith 597