A heroin addict thanked a York judge for "doing him a favour" by jailing him for nine months for drug dealing and other offences.

An undercover detective caught Paul Michael Nicholson, 33, with £573 in drug profits, scales and wraps of heroin in Colliergate, York, said Simon Reevell, prosecuting.

He was with two friends and told police they bought the drug and sold it to each other. He did not sell heroin to anyone else. Nicholson, of Tang Hall Lane, York, pleaded guilty to possessing £87.40 worth of heroin with intent to supply and possessing £3.15 worth of cannabis.

Judge Paul Hoffman jailed him for six months for the drug dealing. He added three months for possessing a knife and stealing sweets from a York shop, offences for which Nicholson was on probation.

"I think you have done me a favour," Nicholson told the judge. "I have done you a favour," the judge agreed.

Earlier, the judge had said Nicholson had had an "extraordinary number" of chances by way of probation and community service orders over years of shoplifting and burglary.

Defence barrister Simon Hickey said his client committed crimes to buy heroin, but now claimed to be drug-free and was attending drug counselling sessions.

York Crown Court heard a probation officer's assessment that Nicholson was using "significant" amounts of heroin daily while on probation.