A patient at Wales' largest hospital caused almost £50,000 of damage - resulting in dozens of people being evacuated - after causing a fire by smoking in bed.
Lee Williams sparked the blaze at the University Hospital of Wales (UHW) in Cardiff after repeated warnings that he could not smoke.
Despite stern instructions from staff the 44-year-old lit up a cigarette while wearing an oxygen mask and caused a serious fire sending thick smoke through the ward.
Cardiff Crown Court heard the extensive damage meant the ward was forced to close for two weeks, 38 patients had to be moved, and medical staff had to receive treatment due to smoke inhalation and shock.
Andrew Kendall, prosecuting, said in May 2019 Williams was an inpatient at UHW and had been for around two weeks before the incident. His treatment meant he needed oxygen and a nebuliser.
On May 7 a nurse went to see Williams but she found him smoking and he appeared to be asleep. The nurse later said she believed he was smoking spice due to the condition she found him in.
She took his cigarette and put his smoking materials away in a cupboard. The nurse and a registrar later returned to Williams' cubicle to warn him against smoking and the dangers it presented. The court heard on Wednesday that Williams said he "did not care" and would smoke if he wanted to.
The same nurse later went to see Williams again and described him as "agitated". As she left he spat on her back, forcing her to change her clothes, and he tried to gain access to his smoking material.
Despite the warnings, on May 8, staff on the C5 ward were alerted to a fire in Williams' cubicle. They arrived to find a quickly-growing blaze on his bed and Williams with a "blackened nose" and injuries to his mouth.
Williams had to be connected to a defibrillator and required emergency treatment. Mr Kendall said the staff rushed into the "smoke-filled room" with several later needing treatment themselves.
He added that an investigation found that "smoking while using an oxygen mask" was the "probable cause" of the fire.
The damage caused £47,500 worth of damage and the closure "added pressure to the rest of the hospital," Mr Kendall explained.
Williams admitted assaulting an emergency worker and arson with intent to endanger life in relation to those matters.
Williams, who has 25 convictions for 68 previous offences, was also sentenced for other charges relating to possession of an air rifle.
On June 20, firearm officers entered Williams' property after a complaint from a neighbour. The court heard that after a previous conviction in 2016 for affray Williams was prohibited from possessing an air rifle for five years.
Laurence Jones, defending, told the court his client believed it was a ban of three years and said it was "simply a mistake".
Williams admitted possession of an air weapon while prohibited and possession of air weapon ammunition while prohibited.
In relation to the arson Mr Jones said Williams was "remorseful" for his actions which he has little recollection of.
Mr Jones added that Williams "may have been in a state of confusion through self-medication" and has had alcohol and drug misuse issues since childhood.
Judge David Wynn Morgan told the defendant that "selfishness" was behind his desire to smoke. He said: "You were told in the clearest terms you could not smoke in the hospital.
"The dangers of fire were made clear to you. Your response was: 'I don't care, it is my decision to have a cigarette'."
He added: "You put at risk the life of the doctor who rushed to treat you, the two nurses who helped, the security staff who put out the fire, and the 38 patients who had to be evacuated in the thick smoke."
The judge handed Williams, of Baglan Street, Treherbert, a total jail sentence of five years in custody.
He will serve half before being released on licence.