mosques and lamps over them.” I know of no disagreement that building a mosque and lighting lamps over graves constitutes disobedience to Allah and His Messenger. Discussing these conditions in detail would take a very long time; here we mention only their general principles.
The third category:
An act that is neither discouraged nor recommended in Islamic law, but is merely permissible, with neither performing it nor refraining from it being preferable. Some scholars have held that fulfilling such a condition is obligatory. However, the majority of scholars, both those belonging to the well-known schools of law and others, hold that it is an invalid condition. In their view, a condition is valid only if it involves an act that brings one closer to Allah Most High.
This is because a person may spend his wealth only on something beneficial in religious or worldly affairs. As long as a person is alive, he may spend his wealth to attain permissible objectives, since he benefits from doing so. After death, however, he no longer benefits from the deeds of the living except through a righteous deed that he instructed others to perform or helped bring about, or whose reward has been gifted to him, and similar things. As for deeds that do not constitute obedience to Allah and His Messenger, the deceased derives no benefit whatsoever from them.
Thus, if a testator or the founder of an endowment stipulates an act or an attribute that carries no reward, striving to fulfil it amounts to striving for something that benefits him neither in this world nor in the Hereafter. This is not permissible. His purpose in establishing the endowment is only to draw closer to Allah Most High, and the Lawgiver knows better than the founders of endowments what brings one closer to Allah Most High. Their conditions must therefore be implemented in accordance with what Allah stipulates and approves concerning them.