A Montana man has pleaded guilty but mentally ill to beating his grandmother to death with a chair in December 2013, shortly after he was released from the state psychiatric hospital.

Tyler Dan Perry entered his plea to deliberate homicide Tuesday under a deal with prosecutors.

Deputy Missoula County Attorney Jason Marks says the plea agreement calls for a 60-year commitment to the psychiatric hospital when Perry is sentenced on May 12.

Prosecutors charged the 25-year-old Perry with killing his 72-year-old grandmother, Carol Perry, while she was lying on the couch watching television.

Court records say Tyler Perry told investigators his grandmother had a "third eye" and that "everybody knew we had to bash her over the head."