Rapist John Westland, 29, is accused of using a smashed aftershave bottle to murder Liam Deane at the Leeds prison on November 12 last year.
Jurors have been told Deane was serving a life sentence for the murder of a child aged under one year old.
Leeds Crown Court has heard Deane was found dead by prison officers on the top bunk of his cell after Westland pressed an emergency buzzer.
Opening the case, Peter Moulson, QC, prosecuting, said Westland and Deane shared cell 21 on landing four of the jail's F wing.
At the time of the alleged attack they were the only two people sharing the cell.
The prosecutor said: "Mr Deane was found dead because someone, say the prosecution, had assaulted him.
"Obviously there is only one candidate."
The jury of seven women and five men were told that Deane had been attacked by a fragment of fragments of glass from a smashed aftershave bottle.
Mr Mouslon said there was also evidence that Deane had been strangled.
Westland pleads not guilty to murder.
Mr Moulson said it was a pathologist's conclusion that Deane died as a result of the physical injuries he sustained.
The pathologist's view is that the Deane's injuries were not typical of self-inflicted injury.
The court heard Westland was arrested after Deane's death and told police in interview: "I murdered him because he is a sex offender"
Westland denied responsibility for causing the injuries when he gave evidence at the trial.
Westland said Deane was being bullied at the prison and had received death threats from other inmates.
Westland described how he and Deane would take the synthetic cannabis drug spice in their cell "every day".
The defendant said the two of them would sometimes share their supplies of the drug and had smoked it in the hours before Deane was found dead.
Westland said he got out of bed in the early hours of the morning and noticed that Deane's t-shirt was covered in blood as he lay on his bunk.
Westland said he saw blood coming from Deane's neck.
He described using a pair of tracksuit bottoms to try to stem the bleeding.
Westland's barrister, Simon Kealey, QC, asked: "Could you say how he came to be injured." He replied: "I don't know."
Mr Kealey also asked: "Did you assault Liam Deane that night?" Deane replied: "No."
The barrister continued: "Did you hit him with a piece of broken glass to the back of his head and face?"
Westland replied: "No"