Louise Gallagher, prosecuting, told Sheffield Crown Court that at around 10.30am on January 1 this year, John Kent's mother was awoken by the sounds of her teenage daughter screaming that the house was on fire.
Ms Gallagher said the woman soon realised it was her son's room that had caught light.
She said: "When she came out on to the landing she saw plumes of smoke."
Ms Gallagher added: "Her younger son reported that he had seen his brother run from the house about 5-10 minutes before the fire alarm went off."
Later that morning, Ms Gallagher described how Kent, of Levet Road, Cantley, phoned his younger sister and admitted to starting the fire.
She said: "He told her: "I didn't know why I had done it, I thought mum would wake up and put it out'."
The court was told how Kent spoke about wanting to take his own life during police interviews.
The cost of the damage to the property was estimated to be around Â£20,000, with an additional Â£500 for the family's possessions destroyed by the blaze.
Kent admitted the offence at an earlier hearing.
The court was told the 26-year-old suffered from depression and emotional instability disorder.
Consultant Forensic Psychologist Mohammed Butt told the court he recommended that Kent was made the subject of a hospital order, by way of sentence.
Judge Robert Moore followed the recommendation made Kent the subject of a hospital order, using section 37 and 41 of the Mental Health Act 1987.
He told Kent: "I am satisfied that you are suffering from a disorder that's capable of being treated within a hospital."