A drug dealer caught with thousands of pounds worth of heroin has been given a two-year suspended jail sentence.
Ian Say had the large lump of class A drugs in his pocket when he got home as police were raiding his flat almost two years ago.
But after hearing he had used the time since his arrest to get off drugs a judge decided the 45-year-old was at a 'turning point' and imposed a suspended sentence.
Tessa Hingston, prosecuting, told Swindon Crown Court he had 83.6 grams of heroin in one lump in his pocket on Wednesday, March 14, 2012.
She said it was uncut and could have been worth up to £5,600 if it was divided up into street deals and he had texts on his phone which showed he had been dealing.
But he insisted the drugs were for his own use after he had stolen them from his a dealer shortly before his arrest when he was living on Park Road, Trowbridge.
Say, now of Charlotte Square in the town, pleaded not guilty to a charge of possessing drugs with intent to supply but was convicted following a trial.
Paul Grumbar, defending, said at the time of his arrest his client was an addict, injecting heroin into his groin.
He said it was unlikely he was involved in direct dealing as he would not have been trusted with the stock.
"What seems to have happened is his arrest and indeed the whole trial process has had a very salutary effect upon him and he has stopped taking the drugs," he said.
Passing sentence, Judge Douglas Field said "I have a letter from the Wiltshire Substance Misuse Service people who tell me you have been regularly tested from February 14 through to the end of the month and been negative for various drugs including, importantly, opiates.
"I have decided that you are at a turning point. All of this happened some time ago and you haven't offended in the meantime.
"You have taken these rather remarkable steps to rid yourself of this drug habit."
He imposed a two-year jail term suspended for a year and a six-month drug rehabilitation requirement and 120 hours of unpaid work.