Undercover police snared a cocaine dealer by posing as drug customers.
The plain-clothed officers kept tabs on three Scarborough men they suspected of dealing and called one of them to arrange a hook-up with two of the suspects at a property in the town.
One of them was 28-year-old Daniel Piccinato, who handed over a grip-seal bag containing 1oz of the Class A drug worth just over £2,000.
Sobia Ahmed, prosecuting at York Crown Court, said the potential street value of the drugs, once they had been cut, would have been between £2,600 and £3,900.
Piccinato was arrested and charged with supplying 27.2g of high-purity cocaine on January 15. He appeared for sentence on Friday after pleading guilty to the charge.
Ms Ahmed said that police also found some cannabis and £360 on Piccinato on the day of his arrest.
Piccinato’s lawyer said his client, who was living in Scarborough at the time, had since left the seaside town to get away from bad influences and had found new work.
Piccinato, now of Baker Street, York, said he had been holding the cocaine for a friend.
Recorder Euan Duff said that Piccinato’s “misplaced loyalty” to his drug-dealing friend had marred his previously-clean criminal record.
He gave him a 16-month jail sentence, but suspended this for two years because of his early guilty plea and lack of previous convictions.
Piccinato was also ordered to carry out 120 hours’ unpaid work and pay a £100 surcharge.