The Prophet, sallallaahu alayhi wa sallam, warned against all means that are conducive (made possible) to Shirk, and cautioned against them vehemently (strongly). Of such means are visiting graves, for which he set protective regulations against worshiping them, or revering exceedingly, the people buried in them. Of such regulations:
1. Excessive love of the pious and righteous people, for this may lead to worshipping them. He said:
اياكم والغلو، فإنما اهلك من كان قبلكم الغلو.
“Beware of excess, for excess destroyed the people before you.” [Ahmed]
And he said:
لا تطرني كما أطْرت النصارى ابْن مرْيم. إنما أنا عبْدٌ فقولوا عبْدُاللّه ورسوله.
“Do not praise me excessively as the Christians praised the son of Maryam excessively. I am only a human slave, therefore call me the Slave of Allaah and His Messenger.” [Bukhari]
2. He also cautioned against erecting (building) structures on graves. Ali Ibn Abi Taalib, radhiAllaahu anhu, said to Abul Hayyaj al Asadi:
“Shall I charge you with a duty which the Prophet, sallallaahu alayhi wa sallam, charged me with? Destroy every Idol or statue, and level down every raised grave.” [Muslim]
The Prophet, sallallaahu alayhi wa sallam, also said:
“Forbade plastering graves, sitting on them, or erecting structures on them, or to include it in a structure.” [Muslim]
Aa'ishah, radhiAllaahu anha, said:
“When the Messenger of Allaah, sallallaahu alayhi wa sallam, felt sick, he covered his face with a piece of cloth. And whenever he suffered pain, he uncovered his face and said: ‘The curse of Allaah is upon the Jews and the Christians who have taken the graves of their Prophet’s for places of worship.’ He said that warning against what they did. Had it not been for that, he would have ordered his grave to be raised, but he feared that it would be taken for a masjid.” [Bukhari and Muslim]
And he said: “Lo! Beware, those who were before you, used to take the graves of their prophets as places of worship. Beware, never take graves for mosques. I forbid you in doing so.” [Muslim]
Taking graves for masajid means praying by them (graves), even if no Masjid is built around them, for every place which is used for praying is a Masjid.
The Prophet, sallallaahu alayhi wa sallam, said:
جعلتْ لي مسجداً وطهورًا
“The Earth has been made for me a place of prayer and a medium for purification*.” [Bukhari]
* A medium for purification means when a Muslim runs short of water for wudhu, he may perform tayammum by striking his hands on a dusty surface to wipe his face and hands in lieu of wudhu.
If praying by a grave is forbidden, then it is more so if a grave is included in a Masjid.
Many people nowadays violate these prohibitions, and commit what the Prophet, sallallaahu alayhi wa sallam, cautioned against, and end up falling into major shirk. They build mosques on graves and tomb chambers for visitation where many rituals of major shirk are practiced, such as making offerings to entombed people, seeking their help, fulfilling vows to them, and the like.
Ibn al Qayyim, rahimahullaah, said: “He who compares the practice of the Messenger, sallallaahu alayhi wa sallam, and his commands and prohibitions with regards to graves, and the practice of his Companions with rituals that people practice today, he can see the two sides are too contradictory and oppose one another, that they can never be reconciled. The Messenger of Allaah, sallallaahu alayhi wa sallam, forbade performing Salaat while facing graves, but people today do so. And he forbade including graves in the masajid, and people today construct masajid around them and call them places for ritual visitation in opposition to the houses of Allaah. And he forbade lighting candles on graves, and people today do so, and assign properties as endowment (funding/donation etc.) for this particular purpose. And he forbade making tombs as places for ritual celebrations, and people do so just as they celebrate Eid, or even more.
Abu Thumamah b. Shufay reported: "We were with Fudalah b. Ubayd in Rhodes, when a man in our group died, and Fudalah ordered that his grave be leveled with the ground, and said, 'I heard the Messenger of Allaah sallallaahu alayhi wa sallam, commanding the leveling of graves.’”
And people today oppose these two traditions, and raise graves above ground level like houses, and build domes above them.
Ibn al Qayyim, rahimahullaah, went on to say: “Consider this great contradiction between what the Prophet, sallallaahu alayhi wa sallam, legislated and intended in prohibiting the above mentioned practices, and what people of today legislate and intend.”
There is no doubt that the wrong things and improper things mentioned above are conducive to unlimited evil.