Two teenage drug dealers who narrowly avoided being locked up were told by a judge to "make the most" of their "lucky escape".
Mitchell Solle and Bradley Woolnough were caught acting suspiciously in Coventry Road, Market Harborough, at 10am on September 15.
Both were detained by the police and Woolnough was found with a bag containing £80 worth of MCat, and various amounts of cannabis worth £320.
Solle had a £10 cannabis deal and a set of digital scales.
Leicester Crown Court was told both their mobile phones contained text messages indicating they were "working together in a business supplying cannabis and MCat," said Neil Bannister, prosecuting.
After being bailed, they were both spotted on January 13 this year, in Market Harborough town centre, at 10am.
Solle was seen to drop a bag, which contained 24.8 grams of cocaine, worth £3,000, 65 grams of MCat worth £1,600 and about £120 worth of cannabis.
Mr Bannister said: "Solle shouted at Woolnough to take the bag, but he ran off.
"Solle's mobile phone contained text messages showing he was continuing to engage in the supply of drugs.
"When arrested he was violent towards one of the officers who was grabbed by the lapels and pushed."
Both defendants admitted possessing cannabis and MCat, with intent to supply, on September 15.
Solle, of New Street, Desborough, Kettering, who was 17 at the time of the offences, but has since turned 18, further admitted possessing cocaine, cannabis and MCat, with intent to supply, on January 13, along with common assault upon an officer.
He was given a three year youth rehabilitation order with a three month curfew, between 8pm and 7am, and 100 hours of unpaid work.
Judge Nicholas Dean QC told him: "It's important at the age you are to stop offending now otherwise it's an ever decreasing spiral into longer periods of imprisonment.
"You've also been on remand in custody for about a month, which is also a factor I take into account."
Woolnough (18), of Bowden Lane, Market Harborough, was sentenced to a two year community order, with supervision, and 80 hours of unpaid work.
Judge Dean said: "The community order is to assist you from offending in future."
He told both defendants they had caused their families "huge anxiety."
He added: "You've had what some may regard as a lucky escape today – make the most of it."
Christopher Trotter, for Solle, said: "He's fully aware of what could happen today but has shown a substantial improvement since he was remanded into custody.
"He was relying on cannabis at the time as a release from mental health problems."
Michelle Harding, for Woolnough, said: "He's been using cannabis for six years and was purchasing and selling it to fund his own habit.
"He was self-medicating for ADHD (attention deficit hyperactivity disorder) and stress when he decided to go into this joint venture with his friend."