A teenager lost his temper and called police “n*****s” when they tried to help him as he stood in the road taking to himself.
Kamran Zafran caught the attention of the officers as they drove along Healds Road in Dewsbury shortly before 11pm on July 3.
The 19-year-old was shouting and talking to himself but became more agitated as they tried to speak with him and calm him down.
Prosecutor Alex Bozman told Kirklees magistrates that he repeatedly called the officers “n*****s” and was arrested.
During the scuffle a carrier bag containing some cannabis fell from his hand.
Mr Bozman said: “He said he didn’t like police and was going to smoke the cannabis later.”
Zafran, of Arncliffe Road in Batley, pleaded guilty to racially-aggravated threatening behaviour and possession of a Class B drug.
His solicitor explained that he had suffered from mental health issues following his recent release from custody and his strange behaviour attracted the attention of police.
Magistrates fined Zafran £200 and ordered him to pay £85 costs and £20 victim surcharge.
The cannabis will be forfeited and destroyed.