A man spotted by eagle-eyed CCTV operators selling drugs in Trowbridge town centre has thanked a judge for giving him a second chance.
'Big Brother' was watching as Jamie Taylor, 21, carried out a deal in the garden behind Trowbridge Town Hall.
And staff in the control room then directed police to Taylor as he cycled off along Silver Street, not knowing he was being watched.
Taylor then tried to get away and he and a police officer narrowly escaped injury when struck a glancing blow by a car when falling from he pavement as they grappled.
Colin Meeke, prosecuting, told Swindon Crown Court last week that the CCTV operator saw the deal taking place shortly before noon on Friday, December 13.
"They saw the defendant clearly involved in an exchange of money for an object: they were almost certainly aware it was a drug deal," he said.
When officers approached he struggled and was restrained after the incident with a passing car and found to have cannabis and cash in his bag.
Mr Meeke said he had 18 street deals of cannabis, worth about £200, and £92 in cash as well as a mobile phone which had texts on it relating to trading in drugs.
Taylor, of Summerleaze, Trowbridge, pleaded guilty to possessing a class-B drug with intent to supply.
Tony Bignall, defending, said he had run up a debt because of a drug problem and his dealer suggested he could pay it off by doing a bit of dealing for him.
He said all of his previous convictions were of an impulsive nature and he could do with some help from the probation service.
Passing sentence, judge Tim Mousley QC said: "You have previous convictions but nothing for drugs.
"You have responded pretty well to past community orders. You are now going to be responsible for a family in a few months' time. As we say, you are at a crossroads.
"You have to face up to your responsibilities and behave in a way to support your family so I am going to give you a chance."
He imposed a 12-month community order with supervision, five sessions of education and training and 18 hours at an attendance centre.
As he left the dock, Taylor said: "Thank you for the chance, Your Honour."