(TNS) — The state appeals court has overturned the child-endangerment conviction of a Kansas man who left his two toddlers locked in a room for 14 hours with their clothing and bedding soaked in their bodily wastes.

The Court of Appeals on Friday ordered a new trial for Samuel Mich White of Garden City because the judge in his case issued an improper instruction to the jury.

White was charged with child abuse and child endangerment in the case that began when a Garden City police officer and a probation officer conducted a surprise inspection at White's home.

According to court documents, the two officers were disturbed by the general messiness of the home and asked to see the children.

White opened the door to a room that was chain-locked from the outside.

"The mattress and room was stained with urine and fecal matter," the appeals court ruling said. "There appeared to be no fresh water or food in the room.

"The room had a strong odor of urine and both children's diapers were sagging and baggy as they were soiled. The closet flooring had been removed and the flooring was lying loosely in the bedroom along with other choking hazards."

Investigation determined that the children, ages 2 and 3, had been locked up from about 10 p.m. the previous night, when White's wife went to bed, until the officers woke White up shortly after noon.

The jury in the case acquitted White of child abuse, but did find him guilty of two counts of child endangerment.

The issue that got his conviction overturned was a jury instruction from the trial judge, Wendell W. Wurst.

The judge told jurors that Kansas law allows "a reasonable amount of force" to be used when a parent disciplines a child.

White argued that the jury instruction implied that he was disciplining the children by keeping them locked up. He said he locked them in the room to protect them from other hazards in the house while he was asleep.

The appellate court agreed that the jury instruction was legally inappropriate, in part because the reasonable force provision in the law is meant to protect a parent's right to discipline children by spanking them.

"White was saddled with an unwanted instruction that clearly changed his theory of defense," the court opinion said. "The district court's decision to add this instruction on parental discipline denied White the meaningful opportunity to present his chosen theory of defense to the jury."