A Tennessee judge offered dozens of inmates about a month off their sentence if they’d undergo surgical sterilization, and many agreed to it, in what critics argued amounted to a eugenics program and a blatant violation of constitutional rights.

Now, nearly two years after a local district attorney first made his concerns about the program known, inmates sued to end deals to get vasectomies or birth control implants, and nationwide outrage grew, sterilization deals are officially quashed after a federal court order Monday night.

“Inmate sterilization is despicable, it is morally indefensible, and it is illegal,” said Daniel Horwitz, a Nashville attorney who represented inmates pro-bono in their lawsuit against White County General Sessions Judge Sam Benningfield and former county sheriff Oddie Shoupe, in a statement. “Let this historic order serve as a warning: Whether you are a sitting judge, a sheriff who is ‘just following orders,’ or any other government official, if you violate the Constitution, you will be held accountable.”

While the program was in practice, White County agreed to sterilize “dozens” of inmates, according to the lawsuit. Both vasectomies and birth control implants can be reversed or removed, but — like all surgical procedures — can be costly and pose medical risks to patients. In an email, Horwitz told VICE News that “several dozen” women received Nexplanon implants through the program, and nobody received vasectomies, though many signed up to do so.

Prior to Monday’s court order, Tennessee banned sterilization deals and Benningfield was formally reprimanded. And the judge, who appears to still be working with the state, said he rescinded the program on his own. Because of those actions, the original lawsuit against Benningfield and Shoupe, filed in 2017, was rendered moot.

But, the inmates’ lawsuit was revived in April when a federal appeals court ruled they could still argue that the program violated their constitutional rights, according to the Tennessean. Monday’s order represents a settlement they reached to formally put an end to all sterilization deals, rescind prior deals, recover the inmates’ legal fees and achieve 30-day credits to shorten the time it’ll take to get their charges expunged.

Benningfield did not immediately respond to a VICE News request for comment. Shoupe, the sheriff named in the lawsuit, left public office in September amid a lawsuit concerning a deadly 2018 police chase. The lawsuit argued Shoupe ordered sheriff’s deputies to shoot a suspect they were chasing “solely to prevent damage to patrol cars.”

One of the men involved in the lawsuit against the judge and former sheriff regarding the sterilization program, Christopher Sullivan, refused a vasectomy and was required to serve an additional 30 days on his sentence, according to court documents. He was in the White County jail for a non-violent probation violation, and has since been released. Nathan Haskell and William Gentry, two other plaintiffs in the lawsuit, were also released last year, according to Horwitz.

Another inmate alleged in the lawsuit that most of the woman who agreed to receive birth control implants “were coming off drugs” and “weren’t in clear judgement to make this decision.” In 2017, Benningfield told CBS News that he was in favor of sterilization agreements to prevent “babies from being born addicted to drugs.” For years, Tennessee has been enveloped in the opioid crisis, but public health experts and advocates have repeatedly warned that programs like White County’s only serve to demonize drug users and punish people living in poverty.

"It seemed to me almost a no-brainer. Offer these women a chance to think about what they're doing and to try to rehabilitate their life," Benningfield told the news outlet. At the time, 38 men had signed up for the vasectomy and 24 women had the implant procedure.

It’s worth noting that babies cannot be “born addicted,” but can exhibit symptoms of neonatal abstinence syndrome if a woman uses opioid drugs while pregnant. Tennessee has a storied history of punishing parents who use drugs with draconian laws, too. The state passed a fetal assault law in 2014 — since sunsetted, though lawmakers are trying to revive it — which lobbed criminal charges on pregnant women using drugs. Critics argued that law kept parents from coming forward to seek treatment.