A Masjid having a grave in the back with a separating wall

A: It is invalid to offer Salah in any Masjid where there is a grave. The Prophet (peace be upon him) is quoted to have prohibited to take graves as Masjids. The prohibition indicates that it is not permissible to perform Salah there whether a building was established upon it or not, or if the grave is attached and connected directly to the Masjid or the Masjid is built for its sake. However, in case the Masjid is separated from the grave with a street or a passage for example, there will be no harm to pray therein. It is not permissible to swear by other than Allah (Glorified be He), neither by the Prophet (peace be upon him) or anyone else because the Prophet stated: Anyone who swears by other than Allah has committed a disbelief or has associated others with Allah. May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.