A teenage driver nearly crashed into a row of parked cars as he desperately threw cannabis out of the driver's window while being chased by gardai.
Ryan Fitzpatrick (19) failed to stop and drove at speed through a residential area.
His lawyer said Fitzpat- rick was a "hardcore cannabis smoker".
Judge Dermot Dempsey fined Fitzpatrick €200 and sentenced him to three months in prison.
The defendant, of Rathvale Park, Ayrfield, admitted before Swords District Court to possession of cannabis as well as having the drug for sale or supply at Kilfenora Drive, The Donaghies, on October 31, 2015.
Gda Janice Gray said she was on patrol shortly before 8pm when she spotted Fitzpatrick driving at speed in the Greenwood estate and along Blunden Drive.
Gda Gray said Fitzpatrick failed to stop and he swerved on to the wrong side of the road. She saw an object thrown out of the driver's window.
The officer said Fitzpatrick nearly crashed into a row of parked cars while he was throwing out the item.
He eventually pulled over, and Gda Gray said she found cannabis loose in the footwell of the vehicle and collected more on the side of the road.
She said the value of the drug was €1,060.
The court heard that Fitzpatrick had three previous convictions.
Defence lawyer Patrick Jackson said his client had a problem with cannabis and found it relaxed him.
He said Fitzpatrick had been studying business in college but dropped out and is hoping to begin a course for barbers soon.
He was due to start it a number of months ago but was attacked at a concert and his jaw was broken.
Mr Jackson said Fitzpatrick has his parents' support.
He also said he was willing to provide clean urines and to attend counselling.