Detective Garda Gary Proudfoot said that when he and two other detectives entered the cell Rattigan jumped up and threw the phone in their direction. He also attempted to grab a SIM card on the bed before he was handcuffed.
Rattigan (31), with a last address at Cooley Road, Drimnagh, has pleaded not guilty to the possession of heroin and two counts of possession of the drug for sale or supply on Hughes Road South, Walkinstown, Dublin, on May 21, 2008.
He has also pleaded not guilty to the possession of two mobile phones at Cell 42, E1 Landing, Portlaoise Prison while an inmate at the prison on May 22, 2008.
The court has heard that gardai who raided a house on Hughes Road South discovered five kilos of heroin valued at over €1m in a shed at the back of the property.
There was evidence that gardai also discovered a red and white Nokia phone alongside an electronic weighing scale in the shed.
At the opening of the prosecution case, Mr O'Kelly said there would be evidence that a text message found on the red and white Nokia phone appeared to relate to the division of a large quantity of heroin and that the message came from a phone number associated with Rattigan.
Detective Garda Proudfoot, of the National Bureau of Criminal Investigation, said that when the three detectives entered Rattigan's cell he saw him lying o his bed talking on a mobile phone.
"He jumped up and threw the phone in our direction and came at us. The phone went out the cell door," he added.
Detective Garda Gary Burns, Organised Crime Unit, said that he found three notebooks and loose sheets of paper on a locker beside Rattigan's bed.
One of the sheets of paper had nicknames and a list of amounts in euro which totalled €120,550.
There were also totals of €31,850, €126,350 and €95,350 listed on the paper. The trial continues on Tuesday.