Praise be to Allah.
1 – The issue of praying at graves
Praying at graves is of two types:
The first type is praying to the occupant of the grave. This is major shirk which puts a person beyond the pale of Islam, because prayer is an act of worship, and it is not permissible to do any act of worship to anyone other than Allaah. Allaah says (interpretation of the meaning):
“Worship Allaah and join none with Him (in worship)”
“Verily, Allaah forgives not (the sin of) setting up partners (in worship) with Him, but He forgives whom He wills, sins other than that, and whoever sets up partners in worship with Allaah, has indeed strayed far away”
The second type is praying to Allaah in the graveyard. This covers a number of issues:
1 – Praying the funeral (janaazah) prayer at the graveside, which is permissible.
Example: if a person dies and you are not able to offer the funeral prayer for him in the mosque, then it is permissible for you to offer the prayer for him after he is buried.
The evidence for this is that this is what the Prophet (peace and blessings of Allaah be upon him) did. It was narrated from Abu Hurayrah that a black man or a black woman used to clean the mosque, and he (or she) died. The Prophet (peace and blessings of Allaah be upon him) asked about him and they said, “He died.” He said, “Why did you not tell me? Show me to his grave (or her grave).” So he went to the grave and offered the funeral prayer. (Narrated by al-Bukhaari, 458; Muslim, 956).
2 – Praying the funeral prayer in the graveyard, which is permissible
Example: a person dies and you are not able to offer the funeral prayer for him in the mosque, so you go to the graveyard and offer the prayer there before he is buried.
Shaykh ‘Abd al-Azeez ibn Baaz (may Allaah have mercy on him) said: “It is permissible to offer the funeral prayer for the deceased inside the graveyard just as it is permissible to offer the funeral prayer for him after he is buried, because it was proven that a woman used to clean the mosque and she died. The Prophet (peace and blessings of Allaah be upon him) asked about her and they said, ‘She died.’ He said, ‘Why did you not tell me? Show me to her grave.’ So they showed him and he offered the prayer for her, then he said, ‘These graves are filled with darkness for their occupants, but Allaah illuminates them by my prayer over them.’” (Narrated by Muslim, 956.)
From Fataawa al-Lajnah al-Daa’imah, 8/392
3 – Praying in the graveyard – apart from the funeral (janaazah) prayer – this prayer is invalid and does not count, whether it is an obligatory prayer or a naafil prayer.
The evidence for that is as follows:
(i)The Prophet (peace and blessings of Allaah be upon him) said: “All the earth is a mosque apart from the graveyards and bathrooms.” (Narrated by al-Tirmidhi, 317; Ibn Maajah, 745; classed as saheeh by al-Albaani in Saheeh Ibn Maajah, 606).
(ii)The Prophet (peace and blessings of Allaah be upon him) said: “May Allaah curse the Jews and the Christians, for they have taken the graves of their Prophets as places of worship.” (Narrated by al-Bukhaari, 435; Muslim, 529).
(iii)Praying in graveyards may be a means that leads to worshipping the graves, or to imitating those who worship graves. Hence, because the kaafirs used to prostrate to the sun as it was rising and setting, the Prophet (peace and blessings of Allaah be upon him) forbade us to pray when the sun is rising or setting, lest that be taken as a means that leads to worshipping the sun instead of Allaah, or to resembling the kuffaar.
4 – Praying towards the graveyard, which is haraam, according to the correct opinion.
Example: you pray with a graveyard or grave in the direction of your qiblah, but you are not praying in the graveyard, rather you are praying on some other ground that is close to the graveyard, with no wall or barrier between you and it.
The evidence for this being haraam:
(i)It was narrated that Abu Marthad al-Ghanawi said: The Messenger of Allaah (peace and blessings of Allaah be upon him) said: “Do not sit on graves, or pray towards them.” (Narrated by Muslim, 972). This indicates that it is haraam to pray towards graveyards or towards graves or towards a single grave.
(ii)The reason why it is not allowed to pray towards a graveyard is the same as the reason why it is not allowed to pray towards a grave. So long as a person is facing towards the grave or graveyard in such a way that it may be said that he is praying towards it, then this comes under the prohibition, and if it comes under the prohibition then it is not valid, because the Prophet (peace and blessings of Allaah be upon him) said, “Do not pray …” The prohibition here is on praying, so if a person prays towards a grave, he is combining obedience and disobedience, and it is not possible to draw closer to Allaah in such a manner.
Note: If there is a wall between you and the graveyard, then the basic principle is that it is acceptable to pray in this case and it is not prohibited. Similarly, if there is a street or a considerable distance which would mean that you cannot be regarded as praying towards the graves, then this is acceptable. And Allaah knows best.
See al-Mughni, 1/403; al-Sharh al-Mumti’ by Ibn ‘Uthaymeen, 2/232.
2 – The issue of intercession
You were mistaken when you said that no one will intercede on the Day of Resurrection except the Prophet (peace and blessings of Allaah be upon him). Rather the Prophet (peace and blessings of Allaah be upon him) will intercede and so will others among the believers. See Question no. 11931.
But we will add here an issue that was not mentioned there, which is that there are conditions attached to intercession:
1 – Permission must be granted by Allaah to the intercessor to intercede.
2 – Allaah must approve of the one for whom intercession is to be made.
The evidence for these two conditions is the verses in which Allaah says (interpretation of the meaning):
“And there are many angels in the heavens, whose intercession will avail nothing except after Allaah has given leave for whom He wills and is pleased with”
“and they cannot intercede except for him with whom He is pleased”
As for the imaginary intercession which the idol-worshippers think their gods perform for them, this is an invalid intercession, for Allaah does not permit intercession unless He is pleased both with the intercessor and those for whom intercession is made.
See al-Qawl al-Mufeed Sharh Kitaab al-Tawheed by Shaykh Muhammad ibn ‘Uthaymeen (may Allaah have mercy on him), p. 336-337.
The fact that the Prophet (peace and blessings of Allaah be upon him) and the believers will intercede does not justify asking them to intercede, as some people do when they ask the Prophet (peace and blessings of Allaah be upon him) to intercede for them even after his death.