A man who handed young trick-or-treaters bags of cocaine on Halloween thought he had given them sweets, a court has heard.
When Donald Junior Green, an apprentice panel beater and college student, realised what he had done he first went out on foot and then drove around looking for the children.
Oldham Magistrates' Court heard the 23-year-old put his hands in his pockets for a bag of Haribo sweets, but instead pulled out a plastic pack containing eight wraps of cocaine he had bought for £200 earlier that day.
He dropped the drugs into the goody bags carried by the three children, aged eight, six and five, who were escorted by their father, an off-duty policeman.
PC Simon Fowell spotted the wraps when the youngsters emptied their goody bags to share the spoils.
He asked his daughter where the items had come from, and she replied from the last property they had called at.
Sean Brady, prosecuting, told the court Green was at his girlfriend's house in Mendip Close, Royton, at the time.
"Had dad not have gone in and recognised what it was, this could have been a very serious case," Mr Brady added.
Steven Sullivan, defending, said Green had initially acted out of "public spirit" by giving out sweets - but that had gone badly wrong.
"This was an accidental act. It was grossly foolhardy," he said.
"It took him only a matter of minutes to realise his error."
Green, of Sycamore Avenue, Oldham, admitted a single charge of possessing a Class A drug on October 31 and was handed a 12-month community order.
He was ordered to carry out 130 hours community work and pay £145 court costs.