Ricky Maher, of Stanley Place, Preston, had been taken by ambulance to the Royal Preston Hospital after being found intoxicated in the street in Preston city centre.
But the defendant repaid the care shown to him by making racist comments and urinating on the floor and wall in the hospital.
Prosecuting, Pam Ward said: “On June 27, at around 10.40pm, police were contacted by the Royal Preston Hospital following reports a man was being abusive and had urinated on the wall.
“Three members of security staff were standing outside detaining the defendant.
Flood works outside Penwortham Methodist Church “causing absolute chaos”
‘Wicked and cruel’ man attacked woman with axe before tying her up and raping her in Accrington
Finney House Care Home: Preston care home still requires improvement after risk of harm from paracetamol overdose
Accrington man who seriously injured victim after launching vicious machete attack jailed
'No-kill' animal shelter forced to explain why they put two healthy dogs to sleep at Blackpool site
“They described he had been abusive and had urinated on the floor inside.
“He was escorted out of the hospital.
“He had been brought by ambulance after being found drunk.
“He began to be verbally abusive, shouting swear words. He was advised by police to stop swearing. He didn’t stop.”
The court heard 31-year-old Maher then made a racist threat.
A police van arrived with two officers to escort him away, but he continued to make comments of a racist nature to them.
During an appearance before Preston Magistrates’ Court - on his birthday - Maher pleaded guilty to using racially aggravated threatening words or behaviour to cause alarm or distress, and criminal damage.
He was ordered to pay a total of £220 in fines.
He must also pay a £30 victim surcharge and £85 towards costs.