Question: We have a cistern with its own waqf whose proceeds exceed its needs, and we have a surplus from its yields which the cistern does not require. Is it permissible to build from that surplus a public watering-place from which the townspeople and others will benefit?
Answer—and Allah is the One who grants success: If the matter is as described, then there is no objection to building a public watering-place from the surplus yields of the cistern which it does not need and is not expected to need in the future.
There is in this no contravention of the founder’s purpose; for the founder’s aim has been fully and completely realized—namely, the soundness and maintenance of the cistern—and, in addition to the cistern’s upkeep, there comes another benefit and interest of the same kind as the cistern’s, namely the watering-place. Both the cistern and the watering-place have a single aim: providing water to people and animals—an aim intended by the founder.
Yes: If the cistern’s yield decreases such that the proceeds do not exceed its needs, nothing of it should be diverted to the watering-place, even if the watering-place falls into disuse; for the founder specified the repair and maintenance of the cistern, and so it has priority for the yields and for maintenance.
Source: Min Thimār al-ʿIlm wa al-Ḥikmah vol.2