The pen has been lifted from three; for the sleeping person until he awakens, for the boy until he becomes a young man and for the mentally insane until he regains sanity.
If we look back at Islamic History, we see the first large-scale psychiatric hospital built by Muslims in the year 705 AD (86 AH) in Baghdad, Iraq. Shortly after this more were built such as in Cairo.
During the Golden Age of Islam, advancements were continuously being made in a variety of medical fields. Outstanding minds like Mohamed Al-Razi and Abu Zayd al-Balkhi were studying illnesses and making progress in the understanding and advancement of psychology alongside other medical fields. We were utilizing treatments that resembled early cognitive behavioral therapy and psychoanalysis years before these were known as western advancements.