Faith-based adoption agencies won a landmark religious liberty case against the state of Michigan on Thursday.

District Judge Robert Jonker ruled religious agencies that contract with the state of Michigan are allowed to refuse to place children in same-sex households, saying under a preliminary injunction that "the state’s real goal is not to promote non-discriminatory child placements, but to stamp out St. Vincent’s religious belief and replace it with the State’s own.”

STUDENT BARRED FROM HANDING OUT 'JESUS LOVES YOU' VALENTINES WINS CASE AGAINST WISCONSIN COLLEGE

Lori Windham, an attorney for the Becket Fund for Religious Liberty, celebrated the ruling as a "major victory."

"[The] judge was very clear this is NOT about whether same-sex couples can adopt — it is about making sure there are more homes for families, and whether the state can penalize a group for their beliefs," she said.

In April, the Becket Fund sued on behalf of Chad and Melissa Buck and St. Vincent Catholic Charities "in fighting the Attorney General of Michigan’s attempt to shut down faith-based foster and adoption agencies."

The Bucks, who adopted five children with special needs through St. Vincent, were recognized by President Trump at the National Prayer Breakfast earlier this year.

The lawsuit was filed weeks after state Attorney General Dana Nessel, a Democrat and Michigan's first openly gay statewide officeholder, resolved a 2017 lawsuit filed by the American Civil Liberties Union on behalf of two lesbian couples. The settlement reversed a 2015 Republican-backed law that lets child-placement agencies not provide any services that conflict with their religious beliefs if they are under contract with the state.

The Becket Fund's complaint alleged violations of the plaintiffs' First Amendment rights and the federal Religious Freedom Restoration Act — claims on which the plaintiffs will likely prevail, according to the judge.

HIGH SCHOOL TENNIS STARS PENALIZED FOR HAVING ‘WRONG’ FAITH, SCORE RELIGIOUS EXEMPTION

“St. Vincent has been with us every step of our journey: answering every phone call, coming with us to doctor’s appointments, even bringing us food, as we strive to give our five beautiful children the best future they can have,” Melissa Buck said in a statement. “St. Vincent brought our family together, and I’m happy to know they can keep doing their great work helping children find homes.”

Jonker, an appointee of former President George W. Bush, said Nessel's action conflicted with state law, existing contracts and established practices. She "targeted" St. Vincent, he said, at the "very heart" of the case after she made past statements referring to proponents of the 2015 law as "hate-mongers" and calling the measure indefensible during her 2018 campaign.

Michigan, like most states, contracts with private agencies to place children from troubled homes with new families. There are currently 13,000 children in the state's foster care system.

Jonker, in issuing a preliminary injunction, said Lansing-based Catholic adoption agency's longstanding practice of adhering to its religious beliefs and referring same-sex and unmarried couples to other agencies is not discriminatory.

Wanting to cancel the contract "would disrupt a carefully balanced and established practice that ensures nondiscrimination in child placements while still accommodating traditional Catholic religious beliefs on marriage," he wrote.

CLICK HERE TO GET THE FOX NEWS APP

"Today's ruling requires the state to put the individual religious beliefs of foster care agencies ahead of the welfare of children," said Jay Kaplan, staff attorney for the ACLU of Michigan's LGBT Project. "This will not facilitate foster and adoptive placements for children in need. Instead, it will allow agencies to turn away same-sex foster parents who are able to provide supportive and loving homes for these children."

A spokeswoman for Nessel said her office was reviewing the decision to determine the next steps.

The Associated Press contributed to this report.