A boy who threw a brick at a moving train was warned he could have received a custodial sentence for his offending.

The 15-year-old was sentenced by magistrates for six offences, which also included criminal damage, trespassing on a railway and assaulting a police officer.

The teen, who cannot be named for legal reasons, received a youth rehabilitation order at a youth court hearing sitting in Poole on Tuesday, July 18.

Chairman of the bench David Ruston told the boy: “The offences are so serious that we could have imposed a custodial sentence and you need to bear that in mind.”

Prosecuting, Shami Duggal said police received a call from a member of night security staff in Poole concerning activity in the Falkland Square area shortly before 2am on Monday, June 19.

At 11.53pm on Sunday, June 18, CCTV showed the boy “throwing an item at a moving train”.

“The CCTV also showed that at 1.53am on Monday, June 19, the defendant was walking onto the railway tracks to pick up a brick,” Ms Duggal said.

“At 1.54am he threw that brick at a security camera.”

The camera fell to the ground before the youth stamped on it and threw a brick at it again.

The defendant picked up the camera and took it with him before deciding to throw it at another CCTV camera.

Ms Duggal said a special constable arrived in the area at 2.12am and found the defendant sitting on a bench with a CCTV camera next to him.

The prosecutor said the boy also committed offences in Bristol in late May.

The court heard he threatened to stab multiple people before being arrested by officers.

He became abusive to officers and spat at a police constable.

The boy admitted trespassing on railway property, throwing an object capable of injuring or damaging a person or property on a railway, criminal damage, assault by beating of an emergency worker, using threatening or abusive words or behaviour likely to cause harassment, alarm or distress and breach of a referral order contract.

Debra Scudamore, representing the youth, said a change in her client’s circumstances in the past couple of weeks had made a significant difference and there was hope for the future.

“He is a young man who hasn’t really understood, due to his immaturity, the consequences of his actions,” Ms Scudamore said.

She added: “It is early days but there looks like there is light at the end of the tunnel.”

The court heard from representatives in the youth justice service who described the defendant as “honest and open”.

Before ending the hearing, magistrate Mr Ruston told the youth: “We could have quite easily gone down another route and you need to understand that.”

The bench issued a 12-month youth rehabilitation order, which included requirements to take part in supervision to deal with the offending behaviour and a 10-week overnight curfew.

The boy was also ordered to pay £50 compensation to the police officer he spat at.