A suicidal 24-year-old wanted to kill himself when he started a fire at his ground floor flat in Rastrick.
Wayne Gray set light to a bed and sofa in the living room of his flat on Burnsall Road last July, but the intense heat forced him out of the property and he alerted the emergency services.
Bradford Crown Court heard that by the time the fire service arrived, Gray was outside suffering from the effects of smoke inhalation.
The fire caused damage estimated at £15,000 to his own premises.
Gray, who had no previous convictions, immediately confessed to an officer at the scene that he had started the fire because he wanted to kill himself.
During a police interview Gray, who had a history of mental health issues, said he had been depressed and was suffering from auditory hallucinations.
Gray admitted a charge of arson being reckless as to whether lives would be endangered and he was jailed for two years.
Judge Peter Benson said that two psychiatric reports on Gray had resulted in conflicting views about whether he should be subject to a hospital order.
But the judge said the two psychiatrists agreed that the defendant suffered from an emotionally unstable personality disorder and that his condition was affected by his misuse of alcohol and drugs.