A message saying "I'm killing myself tonight" was found on the mobile phone of a man accused of murdering a homeless man by stabbing him 183 times.
The message, from a phone belonging to the accused man Philip Dunbar, was sent on the night following the fatal stabbing.
Mr Dunbar (20) has pleaded not guilty to the murder of 23-year-old homeless man Adam 'Floater' Muldoon in Butler Park, Jobstown Park, Tallaght, on June 22 or 23, 2018.
Mr Muldoon's body was found in the park on the morning of June 23 with 183 stab wounds.
Mr Dunbar has accepted that he carried out the stabbing but told gardaí he has no memory of it.
Detective Garda Mark Shortt yesterday told prosecution counsel Pauline Walley SC that he examined four mobile phones seized during a search of Mr Dunbar's home.
One of the phones was a smartphone attributed to Mr Dunbar and on it he discovered a text exchange between Mr Dunbar and one of his friends on the Saturday evening following the stabbing.
Mr Dunbar's phone sent a message saying: "I'm doing it tonight bro. When I get there I'll talk to you on Snapchat."
He later said: "I'm killing myself tonight. Tell noone and delete these messages."
Det-Gda Shortt also detailed a number of calls and attempted calls between Mr Dunbar and the same friend over the course of that Friday afternoon and evening.
The person who received the message cannot be named by order of the court, but he has previously given evidence that Mr Dunbar came to his home following the stabbing, still carrying the knife, and told him he had stabbed Mr Muldoon.
That witness's mother told Ms Walley that she heard about the stabbing on Facebook that Saturday and noticed that her son was "hovering around" and it seemed as though he wanted to tell her something.
That afternoon he broke down and with tears running down his face told her he was sick about what happened to Adam. He said he wanted to tell her something but begged her not to tell anyone.
He was saying: "I'm not a rat, I'm not a rat."
He then told her what Philip Dunbar had told him about Mr Muldoon and said he was worried Philip was going to hurt himself.
The trial continues today in front of Mr Justice Paul McDermott and a jury of six men and six women.