A young man who was caught with nearly €3,000 worth of cocaine and told a garda to "f**k off" as he locked his car door has avoided a prison sentence.
Zach Parker (22) has been ordered to complete 240 hours of community service in lieu of three months in prison.
Swords District Court heard the defendant claimed he chipped in with friends to buy the drugs and was using cocaine as he was "going through a bad patch".
When he was stopped, he assaulted Gda David Smith during a violent struggle after the officers managed to get him to open the car door, intending to search the vehicle, the court heard.
The defendant then tried to discard the cocaine, but after he was arrested he made full admissions.
Parker, of Jugback Lane, Swords, pleaded guilty to being in possession of €2,950 worth of cocaine for sale or supply at the Malahide Roundabout, north Dublin, on February 4 last year.
Gda Smith told the court he saw Parker driving a car in an erratic manner at 7.45pm.
He signalled the defendant to stop, but he drove for a further 20 metres before pulling in. He then locked the car doors and told Gda Smith to "f**k off".
A violent struggle ensued and the defendant assaulted Gda Smith, who said he has "no lasting injuries".
Defence barrister Annette Kealy said the defendant had arranged with friends that he would pick up the drugs.
"A number of mates contributed to the cost of the drugs and the struggle ensued as he panicked," she said.
"He apologised and made admissions."
Ms Kealy said the defendant turned to drugs as a coping mechanism after his grandmother became terminally ill.
She said the defendant, who worked as a barber for seven years, lost his job as a result.
"He is regretful and is now free of drugs," she said.
Judge Dermot Dempsey handed down the community service order and ordered €1,000 be paid over to the Merchant's Quay Project.