Allah, the Exalted says:
فَفِرُّوا إِلَى اللَّهِ ۖ إِنِّي لَكُم مِّنْهُ نَذِيرٌ مُّبِينٌ
So flee to Allah (from His Torment to His Mercy Islamic Monotheism), verily, I (Muhammadصلى الله عليه وسلم) am a plain warner to you from Him.
- Qur'an (Surah Adh-Dhāriyāt 50)
Sa'd bin Abi Waqqas reported: Messenger of Allah صلى الله عليه وسلم said,
"Allah loves a slave who is pious, free of all wants, and the unnoticed." (Narrated in Sahih Muslim)
Commentary:
Isolation, according to the Hadith, is recommendable for the obedience and worship of Allah. It is particularly approved when the prevalent corruption and social intercourse endanger religion, or its implementation looks no more feasible.
[Source: Riyad-Us-Saliheen by Imam An-Nawawi]