Wa `alaykum As-Salamu wa Rahmatullahi wa Barakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
In his response to your question, Sheikh `Abdul-Bari Az-Zamzami, a member of the Moroccan Scholars’ Association, states:
The Prophet (peace and blessings be upon him) is reported to have said: “Whoever keeps a dog save for hunting or for guarding crops or cattle will lose one large measure (qirat) of his reward each day” (Al-Bukhari and Muslim)
Touching a dog does not nullify ablution because acts that nullify ablution are well known and touching a dog is not one of them. It should be noted that living animals such as dogs are not impure.
Therefore, there is nothing wrong with offering Prayer in a place where dogs are roaming or passing, as Al-Bukhari reported in his Sahih that dogs used to enter the Mosque of the Prophet (peace and blessings be upon him) and then come out.
Allah Almighty knows best.
Editor’s note: This fatwa is from Ask the Scholar’s archive and was originally published at an earlier date.