and in latrines and similar places. If someone prays in any of these and no impurity comes into contact with his body or clothing, the prayer is sound, albeit disliked.” He then said:
“Be aware that praying on the floors of valleys is no more disliked than praying anywhere else. Al-Ghazālī’s claim that prayer in the bottom of a valley is disliked is unsound, and the scholars have rejected it. Al-Shāfiʿī—may Allah have mercy on him—considered it disliked only in the particular valley where the Messenger of Allah ﷺ overslept the prayer, not in every valley. Some scholars even maintained that prayer is not disliked in that very valley, for we cannot be certain that the same devil still lingers there; Allah knows best. Because of this hadith, it is recommended to avoid praying in any place where Satan has been present.”
I say: The literal sense of the hadith points to something higher than mere recommendation—namely, obligation—because the Prophet ﷺ ordered them to leave. If anyone adopts that view, it is our view as well, and Allah knows best. He also said:
“Prayer in a church or a synagogue is disliked.” Ibn al-Mundhir related this opinion from ʿUmar ibn al-Khaṭṭāb, Ibn ʿAbbās, and Mālik—may Allah have mercy on him.
Al-Bukhārī records in muʿallaq form that ʿUmar said, “We do not enter your churches because of the statues and images they contain.” Ibn ʿAbbās used to pray in a church unless it contained statues. Al-Baghawī supplied a full chain in al-Jaʿdiyyāt and added, “If it contained statues he would leave and pray in the rain.”
As for ʿUmar’s statement, ʿAbd al-Razzāq furnished an unbroken chain through Aslam, ʿUmar’s freedman, who said: “When ʿUmar arrived in Syria, a Christian—one of their prominent leaders—prepared food for him and said, ‘I would like…’”