A man was found with drugs wrapped around his penis - after a police station metal detector sounded.
Mark Bloor, 42, pleaded guilty to possession of heroin.
He was arrested on an outstanding warrant and taken to Huddersfield Police Station in Castlegate on November 4.
Vanessa Jones, prosecuting, explained to Kirklees magistrates that while he was being booked in the metal detector sounded.
Bloor, of Helme Lane in Meltham, had on him a small zip bag which he had wrapped around his privates.
The bag contained three wraps of Class A diamorphine.
Mrs Jones said: “He said he kept it there so it wouldn’t fall out of his pocket.”
Bloor admitted that the heroin was meant for his own personal use.
Carl Kingsley, mitigating, said that the matter ought to have been dealt with when his client was sentenced for other matters previously.
Bloor told magistrates that he’d detoxed from drugs during a recent spell in prison.
They gave him an absolute discharge but ordered the forfeiture and destruction of the drugs.