On weeping and fear when passing the graves and ruins of the wrongdoers

Riyad as-Salihin (The Meadows of the Righteous)

by Imam Nawawi

165. Chapter: On weeping and fear when passing the graves and ruins of the wrongdoers, and displaying need of Allah and cautioning against being unmindful of that

955. Ibn 'Umar reported that the Messenger of Allah, may Allah bless him and grant him peace, said to his Companions when they reached al-Hijr, the houses of Thamud, "Do not enter places of people on whom punishment has fallen without weeping. If you do not weep do not enter them, lest what befell them befalls you." [Agreed upon]

In one variant he says, "When the Messenger of Allah, may Allah bless him and grant him peace, passed by al-Hijr, he said, 'Do not enter the houses of those who wronged themselves without weeping lest what befell them befalls you.' Then the Messenger of Allah, may Allah bless him and grant him peace, bowed his head and quickened his pace until he had passed the valley."