A man arrested after children found cocaine amongst sweets collected at Halloween has pleaded guilty to possession of drugs.
Two snap bags of the class A drug were identified by the police officer father of children trick-or-treating in the Royton area of Oldham.
Oldham magistrates heard Donald Junior Green, 23, from Chadderton, Oldham was mortified by his "terrible mistake".
He was given a 12-month community order and must do 130 hours community work.
The apprentice panel beater said he had handed two packets of what he thought were Haribo sweets to the children while at his girlfriend's house in Mendip Close.
He realised his mistake when he put his hand in his pocket and discovered packets of sweets instead of the cocaine, for which he had earlier paid £200.
He said he went out to try to get the drugs back but he could not find the children, who are aged eight, six and five.
The court heard the drugs were spotted by the father of three children, who is a police officer, when they returned home and were dividing up their sweets.
He reported the find to police colleagues and Green, who had never been in trouble with the police before, was arrested.
Green's solicitor Steven Sullivan told magistrates: "When he was arrested he justifiably fell upon his sword and was expecting them and knew exactly what it was for."
He described the mistake to the court as "grossly foolhardy but none-the-less accidental".
"He did not set out to commit a crime and did try to put it right."