Teenagers from Amblecote and Brierley Hill have been caged for their part in violence during a demonstration in Dudley.
A protest by the English Defence League (EDL) on July 17 last year turned ugly when objects including crowd control barriers were thrown at police officers who were being abused and spat on.
At Wolverhampton Crown Court, James Everard, aged 19, of Armstrong Close, Amblecote and Jake Hill, 18, of Alexander Hill, Brierley Hill, admitted affray and were both sent to a young offenders institution - Everard for nine months and Hill for six months.
The pair, along with two other defendants were told by Judge Patrick Thomas QC: “This was not an afternoon's fun, it was a dangerous and unpleasant incident involving a mob attack on police officers doing their duty."
He said it was clear the offending was not linked to the march but towards officers who were present to protect citizens from threats and violence.
The judge added: "I do not think you were particularly concerned with the EDL, you took it upon yourselves to attack the police in a number of ways.
"You were involved in a significant and highly unpleasant and unnecessary public disorder and you tested the patience, self control and discipline of police officers under a hail of abuse and threats."
Mr Hugh O'Brien-quinn, prosecuting, said Everard had been aggressive while stamping on the barriers and he swore at police while Hill, who was carrying a St George's flag, spat at officers.
The Judge told the men: "Most of you claim not to have any involvement in the activities of the EDL. Most of you claim you were part of this gathering simply by chance or by curiosity."
But he stressed it was clear the affray was directed solely towards police officers who were on duty and concluded: "A drink fuelled mob is more dangerous than a sober one."
The court was told five other men have already been dealt with by courts for their part in the trouble with two more on the brink of being committed to crown court.
Stourbridge News