Police found two small bags containing cocaine in the glove box of a car they stopped at Rainey Street car park, Magherafelt, the local Magistrates Court heard.
Alister William Hamilton (23), Shane Court, Broughshane, Ballymena, was given a Conditional Discharge for two years for possessing the drug.
He was also banned from driving for six months in relation to a charge of driving with no insurance.
A PPS lawyer told District Judge Paul Copeland that at 12.05am on June 22, 2012, police heard a car revving around the car park and spotted a vehicle with black smoke coming from its rear.
She said they stopped the vehicle and spoke to Hamilton, who appeared to be nervous. The barrister said police found the bags along with a debit card which had white powder on it.
The prosecutor said when asked about insurance, Hamilton told officers that the vehicle belonged to his employer. She added that the cocaine had an estimated street value of £60.
A defence barrister said Hamilton was currently serving a period of custody for other offences and was due to be released on May 8.
He said defendant then hoped to receive help for his drug and addiction problem and complete a mechanic course in Coleraine.
Judge Copeland told Hamilton he was giving him an opportunity to improve himself and show the court that he could stay out of trouble.