We have a source here Faith and mental health religious resources for healing Templeton Foundation Press  by Harold George Koenig that says  Muslims played a key role in setting up some of the first hospitals built for the care of persons with sever mental illness p  According to historical record the earliest hospital providing care to the insane was in Cairo built in  by Ahmad ibn Tulun the governor of EgyptMuslims also established one of the first hospitals in Europe that was designed specifically for treatment of the mentally ill