A New York judge is facing criticism for ordering a drug-addicted mother of four, who has worked as a prostitute, not to get pregnant again until she has gained custody of her infant son.

Family Court Judge Patricia Gallaher wrote that the order is meant to improve the woman's chances of being rehabilitated and reunited with the boy "without a newer baby making that less likely to happen."

All of the woman's children are being raised by other people.

"Society and its problems are changing, especially with the incredible rise in the use of heroin, and this court needs to adjust in response instead of doing the same tired routine which does not solve the obvious problems in so many cases," the Rochester judge wrote in the December order.

The Democrat & Chronicle first wrote about the case this week.

Jeanne Flavin, a Fordham University sociology professor, said the order "reflects a profound disregard for the human rights and dignity of pregnant and parenting women."

"If the courts and our child welfare systems were truly committed to the health and well-being of families, they would ensure people have the supports they need in order to feed, shelter, educate and care for their children in safe environments," said Flavin, who is on the board of directors of the National Advocates for Pregnant Women, a reproductive justice organization.

The order supplemented a finding of neglect against the mother, identified as Brandy F., that set out a plan for her to follow. Monroe County Public Defender Tim Donaher, whose office represents the woman, said Tuesday he is appealing the underlying decision.

Donaher said he could not comment about his client's reaction to the order or whether she would comply with it.

The order includes a promise not to jail the woman if she violates it and becomes pregnant.

Gallaher's order says the infant was born prematurely in July "and exhibited signs of withdrawal almost immediately after his birth." Two previous children were born addicted to drugs and removed from the mother's care in 2011 and 2014, according to the ruling. A 16-year-old son has been living with his maternal grandmother since 2007 after having access to a hypodermic needle while in his mother's care.

The mother admitted to using crack cocaine, methadone and alcohol while pregnant with her infant son. She also said she had been a prostitute.

Her case is "exactly the kind of case where the respondent neglectful mother should be using birth control," wrote the judge, who has since retired. She ordered the Department of Human Services to cover any birth control expenses.

The New York Civil Liberties Union is considering assisting with an appeal, the Democrat & Chronicle reported. A call to the Genesee Valley chapter was not immediately returned Tuesday.

The case is similar to a 2004 Monroe County ruling by a judge Gallaher served under as a law clerk. An appeals court eventually removed the no-pregnancy provision in that order, which Gallaher referred to as "cutting edge." Gallaher said the current opioid epidemic has made such a provision even more urgent today.

"Having no more pregnancies," she wrote, "should be ordered like the drug treatment, mental health treatment and parenting classes provisions which are boilerplate now."

The Associated Press contributed to this report