Solitude (Khalwat)
As long as the relationship with the Creator is not well-established and grounded, association with the creation is extremely harmful.
The ostensible reason advanced for association with people, viz. fulfilment of their obligations, can be truly fulfilled only if the relationship with the Creator has been firmly grounded. If the relationship with Allah has not been firmly established then neither is duty to creation fulfilled nor duty to the Creator. This fact has been proven by the experience of thousands of Auliya.
Solitude is permissible, in fact, best and advisable (afdhal), for one who has no worldly or Deeni duty pertaining to himself or others to discharge.
Such solitude is of greater merit during times of strife and mischief when it becomes difficult to have patience (sabr) in the face of anxiety, agitation, confusion and anarchy. The Ahadith have extolled solitude during such circumstances. Rasulullah (Sallallahu alayhi wasallam) said in this regard:
“…a man who takes to solitude in the peak of a mountain. He has goats. He fulfils their right and makes the Ibaadat of Allah.”
In another Hadith it appears:
“Soon a time will dawn when the best wealth of a Muslim will be goats. He will go with them to a peak of a mountain and to places where rainwater accumulates. He will flee from mischief taking along his Deen.” (Bukhaari)