A criminal gang leader has been convicted of the possession and supply of almost €1m worth of heroin, which was seized in Dublin almost five years ago while he was in prison.

Brian Rattigan, 31, from Cooley Road in Drimnagh, was running a drugs supply network by mobile phone from his cell in Portlaoise Prison.

The three judges of the Special Criminal Court ruled today that a drugs tick list sent by text, along with notes found in his cell, amounted to directions for the distribution of the 5kg of heroin.

It is the first time a drug dealer has been convicted of running his business from inside prison.

Gardaí found the 5kg of heroin in a shed at the back of a house on Hughes Road South in Walkinstown on 21 May 2008.

They also discovered weighing scales, €36,000 in cash and a mobile phone.

On that phone were messages from the phone Rattigan had in prison relating to the division of the heroin.

He was caught by surprise at 9.30pm the following evening when detectives burst into his cell while he was lying on his bed with a phone in his hand.

Rattigan threw it out the door, but it was recovered along with notebooks, three SIM cards and another phone.

He had sent coded messages about the drugs to his associates, including "Parro", "Dicko", "Ganko" and "Lips".

Heroin was known as "the dark" and Rattigan texted "the dark is there" when it arrived at the house.

"Can you give me half a box of the bad thing for 13" was a text Rattigan received from a customer prepared to pay €13,000 for 500g of heroin.

Rattigan texted "Lips" to "drop E30 up to the Paret man" - the 30 referring to €30,000 found by gardaí at the base of a bed in the house.

One of the last orders Rattigan texted to Lips was to "Get rid of ur phones quick", but by then it was too late.

Rattigan was arrested and charged with possession and supply of the heroin in the house even though he was in prison at the time.

The Special Criminal Court today found he was directing the drug deal and guilty of the charges.

The three judges said that while they were satisfied that Rattigan was in possession of the phone that sent the texts directing the distribution of the heroin, that still did not mean he was guilty of that offence.

However, they were satisfied that a drugs tick list sent by text along with notes found in his cell meant that he was guilty of possession with intent to supply the 5kg of heroin found in the shed in Walkinstown, even though he was in jail at the time.

He is due to be sentenced next month.