Visiting the graves of non-Muslims

Q: Is it permissible to visit the graves of non-Muslims, as Allah gave permission to His Prophet (peace be upon him) to visit the grave of his mother, after knowing that she was of the dwellers of Hellfire? How can we reconcile between this and the Prophet's saying: "When you pass by the dwellings of those being tormented, you should bow"?

A: Visiting the graves is absolutely Mashru` (Islamically permissible). Visiting the graves of Muslims should be to supplicate and seek Allah's Forgiveness for them, and, take admonition. It is authentically reported on the authority of Buraydah (may Allah be pleased with him) that he said: The Messenger of Allah (peace be upon him) used to teach them (his Companions) to recite the following when visiting the graves: Peace be upon you, inhabitants of the abodes, believers and Muslims. Verily, we will, In sha’a-Allah (if Allah wills), join you. We pray to Allah for well-being for ourselves and for you. As for visiting the graves of non-Muslims, this should be for receiving admonition and taking warning. Therefore, when the Prophet (peace be upon him) asked Allah to permit him to visit the grave of his mother, He gave him permission, but when he asked Him to seek forgiveness for her, he was forbidden to. (Related by Muslim in his Sahih)As for the part of the Hadith mentioned in the question, the authentically reported text is found in the Two Sahih (authentic) Books of Hadith (i.e. Al-Bukhari and Muslim) on the authority of Ibn `Umar (may Allah be pleased with him) that when the Prophet (peace be upon him) passed by the dwellings of Thamud people, he (peace be upon him) said: Do not enter to (the dwellings of) those who received punishment, unless you are weeping, (Part No. 7; Page No. 444) lest you be afflicted with what they were afflicted with. Entering the dwellings of people who received punishment is not absolutely prohibited; rather, what is meant is that it is prohibited to visit them while feeling relaxed and happy; as for visiting them weeping, seeking self-admonition, there is nothing wrong with this.May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.