Taking care of graveyards and maintaining them by way of showing respect to their occupants is something that is prescribed, but only to the extent that will keep them in a good state and maintain them, without overstepping the limits prescribed in Islamic teachings, such as venerating them, adorning them and spending money for no good reason to build structures over the graves, plaster them, paint them and so on.
What is prescribed in Islamic teachings is to leave the graves as they are, because by doing that they will serve as a reminder to those who visit them, and there will be nothing done to make people venerate them and exaggerate about them and their occupants.
There is nothing wrong with protecting graveyards by building walls around them, and there is nothing wrong with installing lights in them and doing whatever work is needed to clean the graveyard and make pathways between the graves, without going to extremes and squandering money on that and spending money inappropriately, and without going to extremes. The pathways may be created without paving, and the lights should not be used except when needed when a burial takes place. Those in charge of maintaining graveyards should be told not to plant trees in them and adorn them, or take care of them in ways that go beyond what is needed in order to conduct burials and protect the graves from being tampered with or neglected. All of that is for the purpose of protecting people’s faith and belief in Allah’s oneness (Tawhid), barring any means that could lead to associating others with Him (shirk), upholding the dignity of the Muslim dead, and maintaining the graveyard in good order so that the graveyard may serve as a reminder, which is the purpose for which visiting it is prescribed.
Ash-Shawkani (may Allah have mercy on him) said in Ad-Darari al-Mudi’ah (2/301):
If the purpose behind creating an endowment (waqf) for graves is to build them up or adorn them, that is undoubtedly wrong. Worse than that is doing that which could prompt the visitor to venerate the grave, such as setting up high-quality screens with precious stones and the like, because these are things that prompt uneducated visitors to feel awe and venerate the occupant of that grave, and believe about him that which it is not permissible to believe. End quote.
Shaykh Muhammad ibn Ibrahim (may Allah have mercy on him) said:
There is nothing wrong with building up what has been destroyed in the walls of the graveyard, installing gates that are needed to protect it, appointing guards to watch over it, and doing what is needed, such as cleaning it and making pathways between the graves.
As for planting trees in the graveyard, that is not permissible, and it is imitating what the Christians do, who make their graveyards more akin to gardens or parks. So it is essential to remove the trees and to remove the taps that have been installed to water the trees; however, taps that are needed to provide water for people to drink and to wet the ground in order to keep the dust down may be kept.
With regard to lighting graveyards, there is the fear that it could lead to people putting lamps on the graves, an action for which the Messenger of Allah (blessings and peace of Allah be upon him) cursed the one who does it, especially ignorant people who are attached to myths. So these lights should be removed, so as to bar a means that may lead to shirk.
End quote from Fatawa wa Rasa’il Muhammad ibn Ibrahim, 3/161.
Shaykh Ibn Baz (may Allah have mercy on him) said:
Anyone who is able to play a part in removing these structures, domes and places of worship that have been built over graves, and leave the graves bare, like the graves in al-Baqi` at the time of the Prophet (blessings and peace of Allah be upon him) and at our own time now in Madinah, when the graves are bare, with no structures, places of worship, stones, domes or anything else on them, should do that, because the Messenger (blessings and peace of Allah be upon him) forbade building structures over graves, building places of worship over them and plastering them, as these are means that lead to exaggeration and worshipping the graves alongside Allah.
Similarly, no gifts of money should be given to the graves, no sacrifices should be offered at them, no cloths should be placed over them, and no custodians should be appointed to take care of them. However, walls may be built around graveyards, and if a wall is built around the graveyard, so that it will not be subjected to disrespect and so that it will not be taken as pathways for animals, there is nothing wrong with that.
End quote from Fatawa Nur `ala ad-Darb, 1/271-272.
He (may Allah have mercy on him) was also asked: Is it permissible to put lights in graveyards and create pathways between the graves?
He replied: If that is for the purpose of helping people at the time of burial, or setting up lights on the wall, there is nothing wrong with that. As for placing lamps and lights on the graves, that is not permissible, because the Messenger of Allah (blessings and peace of Allah be upon him) cursed the women who visit graves, taking them as places of worship and putting lamps on them. But if lights are installed to illuminate the street that passes by the graveyard, there is nothing wrong with that. And if a lamp is used when needed to illuminate the place when conducting a burial, or people bring a lamp with them for that purpose, there is nothing wrong with that.
End quote from Majmu` Fatawa Ibn Baz, 13/244-245.
Shaykh Ibn `Uthaymin (may Allah have mercy on him) said:
The graveyard is the abode of the dead, not an abode for the living such that it should be adorned and built up with cement poured on the graves and epitaphs written on them. Rather they are the abode of the dead and must be kept as they are, so that passers-by may take them as a reminder. It is soundly narrated in As-Sahih from Buraydah (may Allah be pleased with him) that the Prophet (blessings and peace of Allah be upon him) said: “I used to forbid you to visit graves, but now visit them, for they will remind you of the hereafter.”
If we allow people to adorn graves, build them up and write epitaphs on them, the graveyards will become places for competing and showing off, and will not be places where the living may be reminded. Hence it is soundly narrated from the Prophet (blessings and peace of Allah be upon him) that he forbade plastering graves, building structures over them, writing on them and sitting on them. For he (blessings and peace of Allah be upon him) forbade things in which there is exaggeration about graves, such as building structures over them, writing on them and so on, and he forbade things in which there is disrespect towards graves and their occupants, therefore he forbade sitting on graves. End quote.
Fatawa Nur `ala ad-Darb, 196/34.
Please see the answer to question no. 126400 for an explanation of permissible ways of taking care of graves and prohibited ways of taking care of them.
And Allah knows best.