How did Islamic nations treat or view mental illnesses?

by -4-a-
Searocksandtrees

Hi OP, can you narrow this down please? Islam has been around for approximately 1400 years, has dominated in various places over time, and still exists today. For example, here's a contemporary map courtesy of Wikipedia.

Could you specify which general geographical region and timeframe you're wondering about? That will greatly assist anyone considering answering here. Thanks!