In Tarrant County, Tex., defendants are sometimes strapped with a stun belt around their legs. The devices are used to deliver a shock in the event the person gets violent or attempts to escape.

But in the case of Terry Lee Morris, the device was used as punishment for refusing to answer a judge’s questions properly during his 2016 trial on charges of soliciting sexual performance from a 15-year-old girl, according to an appeals court. In fact, the judge shocked Morris three times, sending thousands of volts coursing through his body. It scared him so much that Morris never returned for the remainder of his trial and almost all of his sentencing hearing.

The action stunned the Texas Eighth Court of Appeals in El Paso, too. It has now thrown out Morris’s conviction on the grounds that the shocks ordered by State District Judge George Gallagher, and Morris’s subsequent removal from the courtroom, violated his constitutional rights.