In a reply to a letter asking if a man had the right to give up life when it became only a burdensome and painful thing, Gandhi wrote:
"My opinion on that point is as follows.A man who is suffering from an incurable disease and is living thanks to the service rendered to him by others without himself doing anything useful in return has the right to end his life. To fast unto death would be much better for him than to drown himself, for it tests his firmness and leaves room for him to change his mind"
In another case, one of his Ashram's heifers(young cow)fell ill and suffered under great pain. The veterinary surgeon had declared her past all cure. The heifer lay on one side, unable to move, and as it was a big one, she couldn't be lifted about in order to prevent bed sores.She couldn't take nourishment and was being tormented by the flies.Although in this case the sanctity of the cow was involved,Gandhi made up his mind "that the true ahimsa required him to put the heifer out of her misery by having her killed as painless a way as possible".He then called a doctor and when the heifer was dead, Gandhi was in great pain,took a cloth and spread it over its face, and then walked silently back to his room.
(From Gandhi a Life by Krishna Kripalani, NBT publications)
In the words of Gandhi :
"A calf, having been maimed, lay in agony in the ashram and despite all possible treatment and nursing, the surgeon declared the case to be past help and hope. The animal's suffering was very acute.
In the circumstances, I felt that humanity demanded that the agony should be ended by ending life itself. The matter was placed before the whole ashram. Finally, in all humility but with the cleanest of convictions I got in my presence a doctor to administer the calf a quietus by means of a poison injection, and the whole thing was over in less than two minutes.
"Would I apply to human beings the principle that I have enunciated in connection with the calf? Would I like it to be applied in my own case? My reply is yes. Just as a surgeon does not commit himsa when he wields his knife on his patient's body for the latter's benefit, similarly one may find it necessary under certain imperative circumstances to go a step further and sever life from the body in the interest of the sufferer".