A man who stopped off in Ballymena to buy Diazepam tablets on his way home from jail then tried to sell the drugs at Coleraine railway station before falling asleep.
Steven McCloskey (29), of Rosemary Place, Coleraine was found with more than 200 Diazepam tablets in his possession and fearing he may have overdosed he was taken to Coleraine's Causeway Hospital on March 6 this year.
On the same date he also caused damage to a police CCTV camera.
The defendant appeared before Coleraine Magistrates Court on Monday via video link from Maghaberry Prison and admitted charges of possessing Diazepam and having the drug with intent to supply as well as criminal damage and was jailed for five months.
A defence solicitor said the defendant had £170 in his possession after being released from prison and stopped off in Ballymena on the way home and bought Diazepam and never made it as far as his home address. When police went to Coleraine train station they couldn't waken McCloskey and he was taken to hospital.
The court was told the defendant had originally denied trying to sell drugs saying he was "self-medicating" and the Diazepam was for his own use.
The defence lawyer said McCloskey had "long-standing drug issues".
Deputy District Judge Brian Archer said unfortunately as soon as the defendant got out of prison he committed "similar offences".