A Melksham teenager has been handed a suspended jail term after admitting selling cannabis to friends.

Robbie Shore was spotted trying to hide the drugs when police raided a friend's house when he was visiting last year.

The youngster, who was only 17 at the time, was spotted throwing packages out of a window before struggling with officers who tried to arrest him.

But after hearing the 18-year-old was doing well on a community order, imposed by magistrates for other matters, a judge decided not to jail him.

Tessa Hingston, prosecuting, told Swindon Crown Court on Friday officers executed a warrant under the Misuse of Drugs Act in Melksham on Friday November 1.

She said Shore, who was sitting on a window sill, was seen to throw a small white package out on to the street below.

"Officers went to grab him. He placed his hands down his pants and took another white package which he threw out of the window," she said.

When they got hold of him he was found with a small amount of herbal matter in a bag and he said to police 'It's cannabis. It's a tenth mate.'

On the window ledge where he had been sitting they found a cannabis grinder, and on him he had £175 cash and two mobiles.

When the phones were examined detectives found a number of messages about selling drugs including a group text saying he was available for dealing.

The cannabis he threw out of the window was found and in total weighed about 7g, worth £72.50.

Shore, of Williams Close, Melksham, pleaded guilty to possession with intent to supply.

The court heard he was put on a 'fairly intensive community order' last month for offences of dishonesty and possessing cannabis.

Alex Daymond, defending, said his client had grown up in care and started using cannabis before going on to sell it to his friends.

"He clearly wants to address the problems he has. It is a chance to nip this young man's actions in the bud," he said.

Passing sentence, Recorder Alastair Malcolm QC "I hope you now realise the seriousness of what you were doing.

"You could well find yourself going to prison, if you repeat what you were doing you will undoubtedly be going to prison.

"In view of what has been happening since and your response to a community order I am prepared to deal with this by not sending you to prison."

He imposed an eight-month jail term suspended for 18 months and put him on supervision with a drug rehabilitation order and 40 hours of unpaid work.