The practice of keeping female prisoners in shackles while they give birth is barbaric. But it remains legal in more than 40 states, and advocates of prisoners’ rights say it is all too common. A federal appeals court has now found that the shackling of an Arkansas inmate may have violated the Constitution  but the margin was uncomfortably close.

Shawanna Nelson, a nonviolent offender, was 29 years old and six months pregnant when she arrived in Arkansas’s McPherson Unit prison in 2003. When she went into labor, she was taken to a civilian hospital. Although there was no reason to consider her a flight risk, her legs were shackled to a wheelchair, and then, while she went through labor, to the sides of a hospital bed.

Ms. Nelson testified that the shackles prevented her from moving her legs, stretching or changing positions during the most painful part of her labor. She offered evidence that the shackling had caused a permanent hip injury, torn stomach muscles, an umbilical hernia that required an operation and extreme mental anguish.

In a suit against prison officials, Ms. Nelson charged that her Eighth Amendment right to be free of cruel and unusual punishment had been violated. She won an early ruling from the trial court, but a three-judge panel of the United States Court of Appeals for the Eighth Circuit rejected her suit. Now the full appeals court has reversed that decision, ruling, with a 6-to-5 vote, that a jury could find that Ms. Nelson’s shackling was unconstitutional. The court relied in part on a 2002 Supreme Court holding that Alabama’s practice of tying prisoners to a hitching post violated the Eighth Amendment.