Several deals of the illegal drug were never recovered and 13 bags of the drug were found.
The accused man was jailed for four months yesterday at Cork District Court.
Inspector Gary McPolin said that on November 3, 2017, Saulius Barsauskas was searched at Waterloo Terrace, Wellington Road.
“During the course of the search he spat a quantity of bags out of his mouth, 13 of these were recovered.
“An unknown quantity of bags were discarded in the drain. Saulius Barsauskas was arrested on suspicion of having diamorphine for sale or supply.
“While in custody he made a full admission to having the drugs for sale or supply.” The value of the diamorphine seized was over €300.
Defence solicitor Michael Quinlan said the accused had come to Ireland a month before this offence was detected. He came from Lithuania to Ireland in October 2017 on the promise of taking up employment but no job was available when he got here.
Mr Quinlan said the accused found himself in a desperate situation and had no option but to sell the drugs under surveillance from the gang who required him to do so.
The defence solicitor said the accused had no previous convictions in Ireland.
He pleaded guilty to possession of heroin, having the drugs for the purpose of sale or supply and obstructing a drugs search being carried out by Garda Graham Desmond.