Islamic hospitals attained their endowment through charitable donations or bequests, called waqfs. The legal documents establishing a waqf also set forth rules for how the hospital should be organized and operate in relation to the patient, stating that anyone can be admitted irrespective of race, gender, or citizenship. Patients of all socioeconomic statuses would have had access to full treatment, that is, costs were borne by the hospital itself. An example was the Al-Mansuri Hospital, in Cairo, built under the orders of the Mameluke ruler of Egypt, Al-Mansur Qalawun. Its maximum capacity was around 8000, and the annual endowment alone was said to be one-million Dirhams. The design was intended to accommodate various pathologies, for both men and women; as well as a pharmacy, a library, and lecture halls. The lecture halls were used for regular meetings on the status of the hospital, lecturing residents, and staff as well