POLICE received a report of "buying and selling cannabis" on a train and a man was then arrested at Cullybackey Station.
Sam Charles Robinson (25), of Cherryville Street in Belfast, pleaded guilty to a charge of possessing cannabis.
The court heard the defendant was not charged with supplying drugs.
The defendant appeared via video link from prison at Antrim Magistrates' Court, sitting in Ballymena.
A prosecutor said police received a report from a member of the public that a male was on a train at Ballymena Train Station on December 14 last year.
The prosecutor said the allegation was that a male was "buying and selling cannabis".
The prosecutor said police attended Cullybackey Station and when the defendant walked towards them they could smell cannabis.
When they searched Robinson a "small bag of cannabis was found".
The court heard the defendant had 123 previous convictions.
He was in breach of a number of suspended sentences.
The defendant was further remanded in custody and the case was adjourned to June 30.