Updated

A New Jersey appeals court has ruled that a convicted killer spent too much time in solitary confinement after throwing a bucket of feces, urine and hot water at corrections officers.

Rigoberto Mejia was punished after throwing the bucket at an officer outside of his cell in July 2013.

The state corrections department upheld the punishment in two appeals, but the appellate panel ruled Thursday that it was "arbitrary and unreasonable."

The appeals court panel said that Mejia should not have spent more than a year in solitary and that he wasn't properly evaluated for mental health issues.

The judges say they hope the ruling will establish guidelines to treat inmates more fairly.

Mejia is serving a 40-year prison sentence for killing a co-worker at a Spring Lake hotel in December 1991.