A man who threatened rail staff and assaulted a police officer after forcing open the door of a moving train has avoided going to jail.

Stafford Straker was handed a community order by magistrates and banned from all drinking establishments in his home town for a total of five offences.

The 40-year-old boarded a moving train at Marks Tey Railway Station on September 2.

When confronted, Straker became aggressive and grabbed a crew member by the collar, before throwing his mobile phone at platform staff and kicking a police officer on the way to custody.

Straker, of Clermont Avenue, Sudbury, was sentenced at Suffolk Magistrates' Court on Thursday, having earlier admitted opening the door of a train in motion, endangering the safety of a person on the railway, threatening behaviour and assaulting an emergency worker.

He also admitted threatening behaviour towards staff at the Caffeine Lounge video game bar in Sudbury on July 31.

Prosecutor Wayne Ablett said Straker was banned from the bar but turned up late at night and refused to leave, threatening to stab the manager and claiming to have a handgun.

Subagarey Pathmanathan, mitigating, said a community order, as recommended by the probation service in a pre-sentence report, was commensurate with the offences, which she said were committed without premeditation and against a background of mental health and alcohol issues.

"He takes full responsibility for his actions, as demonstrated by his early guilty pleas," she added.

"Remorse is a key factor running through these offences."

She said Straker had been of good character for eight years after receiving alcohol treatment as part of a suspended sentence imposed in 2009 and had already engaged with substance misuse service, Turning Point, adding: "A community order would by no means be a soft option. It would require his compliance and tackle the route cause of his offending much more effectively than a period of imprisonment."

Straker was handed an 18-month community order, banned from pubs and bars in Sudbury for the same length of time, and ordered to complete nine months of alcohol treatment and 30 days of rehabilitation activity requirement.

He was also fined £120 and told to pay £100 compensation to the police officer he assaulted and Caffeine Lounge staff member he threatened.