An appeals court said an inmate with a history of mental illness was improperly found to have violated prison disciplinary rules when, during a therapy session, he said that he felt like harming a prison doctor and a psychologist.

The Appellate Division, Third Department, judges ordered administrators to rescind their finding that inmate Thomas Archie committed a disciplinary violation and to expunge the infraction from his prison record.

“It is undisputed that petitioner suffers from a mental health disorder and that his statements were made during a therapy session in which he was encouraged to express his feelings,” the court said in an unsigned ruling Thursday in Matter of Archie v. Fischer, 517304. “Significantly, there was no evidence presented that the statements made by petitioner were intended as ‘threats.’”

The court noted that the prison psychologist who prepared the misbehavior report said she was unable to determine if Archie actually meant to harm the health care professionals or if he was “speaking out of frustration.”

The inmate said he thought about choking an Office of Mental Health psychologist and wanted to wrap a wire around the neck of a physician who had treated him, according to the ruling from Albany.

Justices John Lahtinen, Leslie Stein, William McCarthy, William Lynch and Christine Clark joined in the decision.

Archie, 47, is serving a five-year sentence for a drug offense in Franklin Correctional Facility in Malone, Franklin County.