A western New York judge has ordered a mother not to get pregnant again until she is able to “get her life together” and become a responsible caretaker for her children, issuing the controversial decision after a fourth child was taken from the woman because of neglect.

The woman, referred to in court documents as Brandy F., is a sex worker and drug addict who allegedly admitted to ingesting crack cocaine, methadone and alcohol while pregnant, Monroe County Family Court Judge Patricia Gallaher wrote in the December 27 decision.

The infant was removed from her custody after he was born in June 2016 prematurely and immediately showing signs of drug withdrawal.

He was the woman’s fourth child and her third to be born addicted to drugs, court documents said.

Her first child, born in 2007, has lived with his maternal grandmother after it was discovered he was “not protected from access to hypothermic needle."

“Over and over this court has had to order children removed from the mother only to see her show up in court in a few months obviously pregnant, often by another man while the [five] Department caseworkers and the court are still working to help that very mother get her already born child or children returned,” Gallaher wrote.

Read: Judge: Man Must Refrain From Sex Until Marriage For Rape Of 14-Year-Old Girl

In her ruling, Gallaher wrote that her goal was to allow Brandy to stabilize her life so she could one day have custody of her children.

Brandy’s sons and daughter “would most probably rejoice in having [a] mother who was clean, sober and competent, and hopefully even would love them as a mother should love her children,” Gallaher wrote.

The judge, who retired in December, noted the responsibility to get Brandy back on track not only falls on the shoulders of the mother-of-four, who did not appear in court, but also on caseworkers to offer family planning and contraception, as the law allows.

Caseworkers cannot require a client to utilize family planning or contraception.

”[E]very woman has a constitutional right to choose to have an abortion, but it is a tragic choice — one this court seeks to avoid having even be considered,” Gallaher wrote. “The best way to do this is obviously to avoid new pregnancies in neglect cases where the woman cannot take care of the children she already has, let alone a new one, and usually cannot even take care of herself.”

The decision has left some in legal circles divided, with some questioning it and others saying it reflects the troubling realities those in family court see every day.

“... The court is not ordering somebody to get an abortion, to go against their religion, to go against privacy and not have sex,” retired Judge Marilyn O’Connor told the Democrat & Chronicle.

O’Connor issued a similar ruling in 2004 — at which time Gallaher worked as a clerk in her office — but it was overturned.

"I understand why the judge may have had good intentions here," KaeLyn Rich, director of the Genesee Valley chapter of the New York Civil Liberties Union, told the Chronicle. "When it comes to interpreting here, we don’t want to set a precedent that the court has the authority to tell a woman not to get pregnant or a man not to procreate."

Read: Judge Outraged That Woman Appeared In Court For Sentencing Not Wearing Pants

Ron Lugbill, Brandy’s attorney, told WHEC that they plan to appeal the decision.

Gallaher acknowledged in her order that it would be difficult to enforce should Brandy violate it, noting that while jail could be a response, it was “not the intent of this decision.”

But she also noted the best interests of children are of utmost concern in family court.

“A child's right to his or her own parent surely is greater than a parent's right to have more children without even the ability to raise them, be a daily presence or support, or contribute positively to their welfare,” she wrote.

“Parent's rights to their children are constitutional protected because families are worthy of fundamental constitutional protection. However, nowhere has this court found a case where a constitutional right to procreate was protected, when there was no reasonable possibility of that parent and child becoming a family.

"Could there be a constitutional protected right to abandon your baby — or is it a crime? The answer appears obvious to this court. Abandoning your child is endangering the welfare of a child and it is a crime, not a constitutional right."

Watch: Humorous Judge Dismisses 'Ridiculous' Ticket When Woman Parks 2 Second Early