A teenager snorted ketamine and threw lit fireworks at riot police during a protest outside a hotel used to house asylum seekers.
Jared Skeete, 19, also shouted abuse at the officers during the incident in Knowsley, Merseyside, in February.
Body-worn video footage taken from behind a line of officers holding riot shields showed Skeete lighting numerous fireworks and throwing them while he stood near a burnt out police van.
A judge also said the teenager had “goaded” police by snorting ketamine – a Class B drug – “deliberately” in front of officers.
Skeete’s lawyer, mitigating said the teenager had become “caught up” in the “mob mentality”.
On Monday at Liverpool Crown Court, Skeete was sentenced to three years’ detention after pleading guilty to violent disorder.
The court heard the offence took place during a protest outside the Suites Hotel in Knowsley on 10 February.
The protest was sparked by social media rumours which incorrectly accused a resident of the hotel of a serious offence.
Skeete had been socialising with friends when he heard about the rumours and joined in.
Martyn Walsh, prosecuting, said Skeete shouted to police: “Why are you protecting the scumbags, you big gang of d***heads?”
When arrested and interviewed Skeete denied being the person shown in the footage from the incident, which resulted in £83,684 worth of damage to five police vehicles.
Read more:
Three arrested after ‘violent scenes’ outside Merseyside hotel
Asylum seekers attacked outside Merseyside hotel
One officer also suffered bruising and another from post-concussion syndrome.
Sentencing Skeete, Judge David Swinnerton said: “The scenes overall were appalling and shameful.
“Your role in it, there at the forefront, very close to the police line, throwing fireworks to them, hurling abuse at them, seeking to remove a shield from an officer therefore exposing him to violence and injury, wrestling with him for his riot shield, all of that is despicable behaviour.
“Those scenes of what you did bring shame on you. They were shameful for the city. That is not who we are.”
Mitigating, Peter White described Skeete as a “young man… who had allowed himself to be caught up in mob mentality.”
“He used this as an opportunity to act in a thoroughly unacceptable manner,” Mr White said.
Be the first to get Breaking News
Install the Sky News app for free
He said Skeete was not part of any right-wing organisation and was not involved in planning the disorder.
“He genuinely wishes to apologise for his actions,” Mr White said.
The prosecution did not continue with a charge of assaulting an emergency worker because it was incorporated into the violent disorder charge, the court was told.