Depression occurs when a person repeatedly punishes himself for not meeting a particular expectation, or for what went wrong. For instance, he may punish himself for not passing a final examination, for losing a job; for losing a loved one, for being spurned by a friend, for being blamed for something he didn't do, or for going to prison.
The punishment may take the form of refusing to do some necessary things for himself. He may refuse to get out of bed in the morning, and so will not brush his teeth, or take a bath. He may refuse to eat properly to maintain his health. He may refuse to go to school, or to work, and when he does, his attitude will be so obnoxious as to drive his friends away.
He would do these things to take away every opportunity to bring purpose and happiness to his life, choosing instead, to punish himself with misery and loneliness, as if to say to himself: this is what you get when you fail me.
As he continues to punish himself, a time will come when he would fall into despair, and consequently lose all hope. Since hope is what energizes the mind and body into action, without hope the body will take very little action, if any at all, for self preservation or the pursuit of happiness.
At this time, the feeling of hopelessness and chronic stress would begin to cause physiological problems in his body. The normal production and flow of body chemicals and enzymes would soon be interrupted, followed by a weakening of the immune system, making his body vulnerable to invading pathogens.
More than this, he may refuse to see the doctor when he falls sick, and inflicts upon himself the final punishment of death.
Fortunately, the majority of depression cases do not end in death. Medical science has been very helpful in this area, in conjunction with faith for those who believe in the power of faith.