In our village there is a mosque in front of which is a grave. There is a wall between them, but there are windows in this wall that overlook the grave. The grave is in the qiblah of the mosque. Is it permissible to pray in this mosque? There are those who say that it is permissible, and others who say that it is not permissible. We need a definitive answer to this important question.
Praise be to Allaah.
It is not permissible to pray in this mosque that is adjoining the grave, especially since the grave is in the qiblah faced by the worshippers, and between them there is a wall with windows in it that overlook the grave. It is still not permissible even if it does not occur to them to venerate the grave. It was reported that it is forbidden to pray in graveyards. ‘Umar saw a man praying at a grave and forbade him to do that, saying, ‘Don’t pray at the grave.’ (Narrated by al-Bayhaqi, 2/435; classified as mu’aalaq by al-Bukhaari in his Saheeh, 1/523; classified as mawsool by ‘Abd al-Razzaaq, 1/404, no. 1581).
On this basis, you have to move the mosque to another place, or enclose the grave with a separate fence that will form a barrier between it and the wall of the mosque. And Allaah knows best.