A 27-year-old pregnant woman detained by police due to a custody dispute was forced to give birth while handcuffed and shackled to a New York City hospital bed after officers refused to remove her restraints, according to a lawsuit filed Thursday.

The woman, only identified as Jane Doe, was reportedly already in labor when cops took her out of a Bronx holding cell and brought her to nearby Montefiore Medical Center -- where police officers handcuffed and shackled her to a bed. Doctors told officers keeping a pregnant woman tied to the bed was illegal in New York, but officers insisted the department’s code required her to be restrained and superceded state law, The New York Times reported, citing the lawsuit.

The woman suffered excruciating pain during labor, and the officers eventually yielded and removed some of her restraints -- but she still had her right hand cuffed to the bed when her baby was delivered, the lawsuit states. The 27-year-old called the entire experience humiliating and traumatizing, according to The New York Times.

“I haven’t made sense of it myself and I’m not ready to explain it to my child,” she said in an affidavit, according to the newspaper.

The woman is seeking damages stemming from the officers' alleged violations of her civil rights and she wants the NYPD to update their policies on shackling a pregnant woman in custody. A spokesman for the city’s Law Department told The New York Times the agency was examining the allegations.

The American College of Obstetricians and Gynecologists says restraining a mother with shackles and handcuffs puts the health of the woman -- and the baby -- at risk

“When you have something as gender-specific as pregnancy, it reminds you of how flawed the system is and how ill-prepared it is to take care of pregnant people and the reproductive health needs of women in general,” Carolyn Sufrin, who works as a medical anthropologist and OB-GYN at Johns Hopkins School of Medicine, told NPR. “They're, if at all, an afterthought.”

The First Step Act, a bipartisan criminal justice bill set to be voted on in Congress, would ban shackling pregnant women in federal prisons.

The Associated Press contributed to this report.