A man high on drink and drugs shouted EDL and Allahu Akbar as police concerned for his welfare chased him.
The officers were called to the Cambridge Hotel in Claire Hill on August 19 where Andrew Batty was acting strangely.
The 27-year-old, a former resident but now of no fixed address, reportedly knocked some wheeled bins over and pushed a woman to the floor.
They discovered him inside the premises, sat on the floor and trying to set fire to his clothes.
Bill Astin, prosecuting, said: “Mr Batty seemed to be under the influence of drink and drugs and they were concerned about his mental state.
“He ran away, they gave chase and eventually he was stopped by police, shouting things like: ‘Come on, I’ll stab you with my knife’.
“Then he continued to shout ‘EDL, EDL and ‘Allahu Akbar’.”
Batty hurled racist abuse at some men walking past and spat at the police officers after being placed in his cell.
Batty, who was not represented, pleaded guilty to racially-aggravated threatening behaviour at Kirklees Magistrates’ Court.
He said he couldn’t remember the incident because he was on drink and drugs.
Batty told District Judge Michael Fanning that he was addicted to heroin and crack cocaine and his problem was getting worse.
He claimed that he didn’t have a problem with people of a different race to him.
Judge Fanning told him: “You can’t behave in this way.
“We’re trying to clear up society and when people shout the things you were shouting it undermines these efforts.”
Batty was fined £240 and ordered to pay £85 costs and £30 victim surcharge.