Raheem Sterling has received a suspended prison sentence after admitting dangerous driving while inhaling nitrous oxide from a balloon, during a journey that ended when his Lamborghini crashed into a metal gate.

The former England footballer, 31, from Berkshire, was sentenced at Basingstoke Magistrates’ Court on Wednesday to 12 months’ imprisonment, suspended for 18 months. He must complete 100 hours of unpaid work and was banned from driving for 24 months.

Sterling pleaded guilty to dangerous driving and possession of nitrous oxide on the M25, M3, A327 and Minley Road on 28 May.

District Judge Kirsty Allman said he had been seen driving “erratically and at speed” at a McDonald’s in Hayes at 01:10 BST while inhaling from a pink balloon. At 07:45, having not slept, he made a “deliberate and entirely selfish decision” to drive while consuming the Class C drug, she said.

The judge said his driving on two motorways during peak travel time exposed many road users to a significant risk of serious harm.

At a September hearing, prosecutor Simon Jones described calls about a black sports car between 07:45 and 08:52 BST. Christopher Jennings called 999 after seeing Sterling inhaling from a balloon on the M25. Fiona Jennings, driving south on the M3, described “absolutely horrendous” driving and the car “swerving in and out of lanes”.

The court heard that Sterling strayed into the M3’s central reservation, left at junction 4A and veered off the A327 into a gate near a layby. Prosecutors said tyre and bodywork damage left the vehicle undriveable.

Defending, Jason Bartfeld KC accepted this was a “top category case” involving prolonged driving, with serious impairment at times, though he said those periods were short. He disputed that the vehicle damage was serious.

Sterling complied with an impairment test but sought legal advice before deciding about a blood sample. A police sergeant considered him deliberately unclear; the defence said there was confusion over providing a specimen. With legal representation, Sterling later admitted being the driver but gave no-comment answers about his driving.

Jones said Sterling disclosed a “problem with nitrous oxide”. The substance, also known as laughing gas, has lawful catering, medical and industrial uses.

Allman accepted that Sterling’s character had been “positively exemplary” and described his drug use as a “maladaptive coping mechanism during a difficult period” in his career. She gave credit for his guilty pleas.

Sterling, currently without a club after eight appearances for Feyenoord following his January departure from Chelsea, showed no reaction to the sentence and left without comment.