One of three men accused of murdering an elderly man received a text message hours before the victim was allegedly beaten to death saying he was a rapist, a jury has heard.

The court also heard the 64-year-old victim had never come to the attention of gardaí and there were no "rumours" relating to him that would concern gardaí.

Matthew Cummins, 22, of Churchview Heights, Edenderry, Co Offaly, 21-year-old Sean Davy of Clonmullen Drive, Edenderry, Co Offaly and 25-year-old James Davy  of Thornhill Meadows, Celbridge, Co Kildare have all pleaded not guilty to murdering 64-year-old Thomas "Toddy" Dooley at his home in Sr Senan Court, Edenderry, Co Offaly on 12 February 2014.

Detective Garda Joe Hughes told prosecuting counsel Patrick Treacy SC that during an interview with Matthew Cummins on 10 June2014 at Tullamore Garda Station, gardaí asked Mr Cummins why Toddy Dooley was killed.

Mr Cummins said that he asked Sean Davy why he had attacked the elderly man, and Sean Davy replied: "He raped my cousin."

The court has already heard that Mr Cummins told gardaí he saw Sean Davy hit Mr Dooley repeatedly with a baseball bat.

Gardaí told Mr Cummins that his co-accused James Davy had received a text message earlier that day, on 11 February, from Chloe McBride, a girl they both knew as Toddy Dooley's granddaughter.

The text read: "Toddy a rapist. I never going there again."

Gardaí said this suggested a motive for the attack and that it was pre-planned.

Mr Cummins said he did not know anything about the text and that he had no idea Mr Dooley would be attacked.

He said he thought they were going in to have a few drinks. "I didn't know if they had a plan. I didn't see it coming," he said.

Det Gda Hughes agreed with Caroline Biggs SC, representing Mr Cummins, that Mr Dooley had never come to the attention of gardaí.

She said he was "soft" and that young people, particularly teenagers, would often gather at Mr Dooley's house and "take advantage" of him. "His house was being used," said Det Gda Hughes.

The jury also heard interviews that Mr Cummins gave to gardaí at Tullamore Garda Station in February 2014.

Det Gda Hughes agreed with Mr Treacy that during those interviews Mr Cummins said he was afraid to come forward following the killing.

Gardaí asked him why he did not call an ambulance. He said he was too afraid.

When asked if he had told his parents he said: "No. I didn't want them to think their son was a murderer."

The trial continues before Justice Margaret Heneghan tomorrow.