Updated

An appeals court has ruled that a federal judge erred in requiring a sex offender to undergo a periodic test that measures his response to erotic images.

In its decision handed down Tuesday, the U.S. 9th Circuit Court of Appeals described the test as "Orwellian" because it examines the mind of Matthew Weber, not just his body.

The three-judge appeals court panel unanimously vacated U.S. District Judge Dean Pregerson's 2001 judgment and sent Weber's case back to district court.

Pregerson had ruled that Weber, in order to be released from prison, would have to undergo tests in which a pressure-sensitive electronic device is placed on his groin and his response to stimulating images is monitored, said his lawyer, Jonathan Libby.

Weber objected to the test, which is used in up to a quarter of all adult sex offender treatment programs, according to the appeals court. Tuesday's ruling doesn't outlaw the test.

Weber was serving a 27-month prison sentence after pleading guilty to possessing child pornography on his computer.