LEWISTON, Idaho (AP) — A death row inmate in Idaho has pleaded guilty to a reduced offense as part of a bargain that ensures he will never be released from prison.

The Lewiston Tribune reports that Gene Francis Stuart on Tuesday pleaded guilty to murder by torture for the 1981 beating death of 3-year-old Robert Miller. Miller was the son of Stuart's then-girlfriend.

Stuart was sentenced to be executed in 1983, but an appeals process began working its way through the court system and he was granted a new sentencing hearing in 2013.

As part of the recent plea agreement, Stuart gave up his right to appeal or to file a motion asking for reconsideration of the sentence. The judge sentenced him to life in prison.