Offering Salah (Prayer) in a Masjid

A: It is invalid to offer Salah in a Masjid where there is a grave, as the Prophet (peace be upon him) stated, Do not take graves as Masjids and he cursed those who do that, as it is a means leading to Shirk (associating others with Allah in His Divinity or worship).May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.