A student nearly caused several accidents driving around Malmesbury streets at speed trying to shake off police after buying cannabis to celebrate taking his last exam.

A pedestrian had to leap out of the way and other cars had to take avoiding action before the 17-year-old eventually pulled over, Chippenham magistrates were told at a youth court.

The teenager, who cannot be named because he is under 18, admitted dangerous driving, possession of cannabis and failing to stop for police.

He was put on a nine-month referral order, banned from driving for a year and ordered to pay £85 costs.

Prosecutor Vyvyan Thatcher said officers spotted the Volkswagen car just before 1pm on January 25 and decided to stop it. After they switched on their blue lights they saw the driver look in the mirror and then accelerate away.

Speeds of up to 60mph were recorded during the incident.

In Bremilham Road a pedestrian was crossing as the car approached and had to jump to avoid the defendant’s car.

The driver of another car had to take violent evasive action on the Gloucester Road roundabout and a short while later an oncoming car had to mount the kerb to avoid a collision when the teen drove on the wrong side of the road.

Kim Brereton, defending, said the youth, who is studying for A-levels and was expected to achieve good grades, had never had any reprimands or warnings and had never been in court before.

He had been on his way to take his last exam and had bought the cannabis to celebrate afterwards.

“He decided to try and get away when he saw the police turn around,” said Ms Brereton, but he did not see the police car following until about half way through the incident.

“For ten minutes of stupidity I’m going to suffer for the next year of my life,” said the teenager.

He told the bench he had panicked and had been worried about his mother finding out.

Chairman of the bench Michael Lightfield told the youth he had been lucky.

“You could have caused at least two accidents in that mad escapade,” he said.

The youngster’s mother, who was in court, said: “I am still shocked it has happened. I think he is very lucky that something worse did not happen and I’m so grateful that it did not.

“I think he has just got to accept the punishment and learn from it.”