Salah between walls and enclosures
     It is allowed for the imam or one who is offering salah    by himself to pray between two walls or enclosures.
    Al-Bukhari and Muslim record from Ibn 'Umar that when the    Prophet entered the Ka'bah, he prayed between two walls.
         Sa'id ibn Jubair, Ibrahim at-Taimi, and Suwaid ibn    Ghuflah led the people in salah while they were between    two columns. It is disliked for the followers to pray    between them if they have enough room because it cuts the    row, but they may do so if they are constrained to it.
         Anas says: "We were prohibited to offer salah between    walls and we would keep others from it." This is related    by al-Hakim who says it is sahih.
         Mu'awiyyah ibn Qurrah relates that his father said: "We    were prohibited to make rows between walls during the    time of the Prophet and we kept others from it." This is    related by Ibn Majah but one of its narrator is majhul    (unknown as a trustworthy person). Sa'id ibn Mansur    records in his Sunan that Ibn Mas'ud, Ibn 'Abbas, and    Hudhaifah prohibited it. Ibn Sayyid an-Nass said: "There    is no known difference among the companions [on this    point]."
    
Graveyards
     'Aishah reports that the Prophet sallallahu alehi    wasallam said: "Allah cursed the Jews and Christians    [because] they took the graves of their prophets as    mosques." This is related by al-Bukhari, Muslim, Ahmad,    and an-Nasa' i .
         Ahmad and Muslim record from Abu Marthad al-Ghanawi that    the Prophet sallallahu alehi wasallam said: "Do not pray    facing a grave and do not sit on one." They also record    that Jundub ibn 'Abdullah al-Bajali heard the Prophet    say, five days before he died: "The people before you    took graves as mosques. I prohibit this to you."
         'Aishah reports that Umm Salamah mentioned the churches    she saw in Abyssinia and the pictures they contained to    the Messenger of Allah. The Prophet said to her: "These    are the people who, when a pious servant or pious man    among them dies, build a mosque [place of worship] upon    their graves and put those pictures in it. They are the    worst of the whole creation in the sight of Allah." This    is related by al-Bukhari, Muslim, and an-Nasa' i .
         The Prophet is also reported to have said: "Allah curses    those who visit the graves and take them as mosques and    light lamps over them." Many scholars take this    prohibition to be one of dislike, regardless of whether    the grave is in front of the imam or behind him.
    According to the zahiri school, this prohibition is one    of complete forbiddance and as such, prayer at a grave    site is not valid. According to the Hanbali school, this    applies only if there are three graves or more. If there    is only one or two graves, then the prayer is valid    although disliked if one prays facing a grave, otherwise    it is not disliked.
    
Help us build Quranic citations related to this hadith. Get connected with our Contact Us option.
"When a person dies, his works end, except for three: ongoing charity, knowledge that is benefited from, and a righteous child who prays for him."
Prophet Mohammed (PBUH)
"The best of what a man leaves behind are three: a righteous child who supplicates for him, ongoing charity the reward of which reaches him, and knowledge that is acted upon after him."
Sunan Ibn Mājah
"Every day two angels come down from Heaven and one of them says, 'O Allah! Compensate every person who spends in Your Cause,' and the other (angel) says, 'O Allah! Destroy every miser.'"
Sahih Bukhari