Imam Ahmad, in the recension transmitted by his son ʿAbd Allah, related with a clearer chain than the previous one from ʿAlī (may Allah honor his face) something similar: that he disapproved of performing the prayer in the land of Babylon and in any land that had been swallowed up by the earth, or the like. On that basis Imam Ahmad himself deemed prayer in such places objectionable, following ʿAlī’s stance. His statement, “He forbade me to pray in the land of Babylon, for it is accursed,” indicates that one should not pray in any accursed land. The well-known ḥadīth concerning al-Ḥijr supports this, for once entry into a land of punishment has been forbidden, prayer and all other acts there naturally fall under the same ruling. This also accords with the Almighty’s words about Masjid al-Ḍirār: “Never stand (to pray) there at all” (Qur’an 9:108), for that mosque was one of the places of punishment. Likewise He said: “Is he who founded his building upon piety toward Allah and His good pleasure better, or he who founded his building upon the brink of a crumbling bank so that it collapsed with him into the Fire of Hell?” (Qur’an 9:109). It is reported that when that mosque was demolished, smoke emerged from it.
As for the report attributed to Ahmad, it is probably found in the Masāʾil of ʿAbd Allah or elsewhere, for I have not located it in the Musnad. Shaykh al-Islām then said in al-Ikhtiyārāt: “The implication of the words of al-Āmidī and Abū al-Wafāʾ ibn ʿAqil is that the prayer is invalid in a land that has sunk, and that view is strong. Ahmad’s explicit statement is: One is not to pray there.”
I say: We have found no evidence for the invalidity of the prayer itself. The ḥadīth forbidding entry into a land of punishment is not specific to prayer, so it cannot be claimed that the prayer performed there is invalid. Likewise, even if the ḥadīth of ʿAlī were sound, it would not prove invalidity. For that reason al-Bayhaqī, after citing it, said: “This prohibition of praying there—if it is authentically traced back (marfūʿ)—is not on account of a factor that returns to…"