Islam treats illness, including illness of the mind, as real and encourages seeking treatment. It teaches that sadness is part of life, that prayer and the remembrance of God bring peace to the heart and that one should also see a doctor.
The fuller answer
The Prophet ﷺ said, 'God has not sent down a disease without sending down a cure,' and told people to seek treatment. Depression is not a sign of weak faith. Prophets themselves felt grief: Jacob wept for Joseph until his eyes turned white, and the Prophet ﷺ called the year he lost his wife and uncle the 'year of sorrow'.
Muslims find comfort in prayer, the Quran, charity, community and trusting that hardship will pass. These are an addition to and not a replacement for therapy or medication. Suicide is forbidden in Islam, as life is a trust from God, and anyone with such thoughts should seek help immediately from a doctor, a trusted person or a crisis line.
O you who have believed, do not consume one another's wealth unjustly but only [in lawful] business by mutual consent. And do not kill yourselves [or one another]. Indeed, Allah is to you ever Merciful.
This answer follows the mainstream Sunni understanding and is general learning, not a fatwa. Where Muslims differ, the answer says so. Have a question of your own? Write to us.