A teenager who marched outside a North Yorkshire Islamic centre with firelighters in his pocket while waving an England flag is going to “lose everything because of one night of stupid behaviour,” a court heard.

James Martin was jailed for two years and two months after the incident on August 8 in Scarborough.

York Crown Court heard Martin was in a group of four people who marched outside the Islamic centre in Roscoe Street while people were inside praying just after 10pm.

He had been swearing, and shouted words to the effect of “What a stupid time to pray, have they got nothing better to be doing,” and “Let’s be proud of our flag”.

A judge said social media that day had been “alive with extremist calls for setting fire to places connected primarily with Islam”.

The court heard a police operation had been in force in the seaside town that day due to fears of disorder.

It was stood down but officers stayed in the area of Roscoe Street “just in case,” it was said.

Martin was initially arrested to prevent a breach of the peace and “continued to exhibit disruptive behaviour,” the court heard.

Police also found a clear plastic bag of firelighters in his pocket.

Martin, who has no previous convictions, will lose an apprenticeship in bricklaying as a result.

Sentencing him to 26 months in custody, Judge Sean Morris, the Recorder of York, told Martin he had “disgraced” the flag he had been carrying, which “belongs to everyone in this country”.

The judge said: “This calls for an immediate prison sentence – there has to be an element of deterrence so other young men aged 18, in work and with no previous convictions, realise that actions have consequences.

“Whether online or on the street, the courts will keep the peace by deterring others from such action.”

Judge Morris said that if Martin had gone ahead with starting a fire, “the consequences could have been fatal”.

The defendant pleaded guilty to racially/religiously aggravated harassment, having an article with intent to destroy/damage property, and obstructing/resisting a constable in the execution of their duty.