A teenager subjected a fellow inmate to a brutal attack with a weapon made from a kettle plug at a Leeds young offender institution.
Connor Renfree put the weapon inside a sock before repeatedly striking the victim over the head during a table tennis game at Wetherby YOI.
Renfree, 18, previously carried out a similar attack on a different inmate at Wetherby YOI and blinded him in one eye.
Renfree was given an extended sentence totalling seven years over the latest offence.
Bashir Ahmed, prosecuting, said Renfree was aged 17 at the time of the attack on November 26 last year.
The incident happened at 6.30pm during inmates' association time in a communal area.
Mr Ahmed said Renfree armed himself with the improvised weapon which he hid down the front of his trousers.
He attacked the victim from behind as he played a game of table tennis.
Renfree struck the inmate to the head and back before he was pulled away by prison officers.
The victim had to be taken to hospital in Harrogate to have stitches to a wound to his head.
He also suffered bruising to his back and body.
Renfree pleaded guilty to wounding with intent.
At the time of the incident he was serving a four-year sentence imposed for attacking an inmate with an aerosol deodorant hidden in a sock.
The victim of that attack was permanently blinded in one eye.
Wetherby YOI governor David Pearce provided a statement to the court describing how the attack had a "devastating impact" among inmates and staff at the institution.
Adam Lodge, mitigating, said: "He had not been taking his medication for a personality disorder and believed the victim was a sex offender and had violent sexual impulses against him.
"The defendant recognises he has an issue with his temper and violent impulses which is very worrying for a man of his tender years."
Renfree was given an extended sentence totalling seven years after being assessed as dangerous.
He must serve a custodial period of four years followed by an extended licence period of three years.