A teenager put Leeds city centre shoppers in danger as he performed stunts on his motorbike while high on ecstasy.
Jordan Haynes, 19, was caught by police after “goading” officers into chasing him.
Leeds Crown Court heard members of the public flagged down a police van near to the Corn Exchange as they were concerned about the way Haynes was riding the off-road motorcycle.
Bashir Ahmed, mitigating, said Haynes had been doing “wheelies” on New Briggate and in the area around Leeds market, narrowly avoiding hitting pedestrians.
Mr Haynes had a pillion passenger at the time and neither of them were wearing helmets.
The officers drove towards Haynes but he went onto the wrong side of the road near to Leeds market and came close to being hit by a bus.
The prosecutor said Haynes stopped the machine in front of the Corn Exchange to allow them to catch up as if inviting them to chase him. Haynes was hemmed in by the van near to a bus stop. He ran into a shop but was caught and arrested by officers. Haynes, of First Avenue, Armley, pleaded guilty to dangerous driving.
A probation officer told the court Haynes had admitted to taking ecstasy tablets before the incident.
Marcus Waite, prosecuting, said Haynes was of low intelligence and had received little support from others during his life. Haynes was given six-months detention, suspended for two years. He was also ordered to take part in a 20-day rehabilitation requirement programme and made the subject of a three-month curfew.
He was banned from driving for 12 months.
Judge Geoffrey Marson, QC, said: “This was madness. You could have killed somebody or seriously injured yourself.”