Michigan will no longer allow faith-based adoption agencies to turn away same-sex couples.

As part of a settlement in a lawsuit brought forth by the American Civil Liberties Union, Attorney General Dana Nessel nixed a four-law old allowing adoption and foster care centers to discriminate in the name of their “religious beliefs.” Her office announced the decision on Friday in a statement calling anti-LGBTQ bias on the part of child placing agencies “illegal.”

“Limiting the opportunity for a child to be adopted or fostered by a loving home not only goes against the state’s goal of finding a home for every child, it is a direct violation of the contract every child-placing agency enters into with the state,” Nessel said.

The Attorney General began negotiating a settlement in the 2017 case after defeating Republican Speaker of the House Tom Leonard for the position in November. The 1.7-point victory made Nessel—who shares two children with her wife, Alanna Maguire—the first LGBTQ person ever elected to statewide office in the state of Michigan.

The case dates back to 2017, when two lesbian couples claimed their application to adopt a child was denied by Catholic Charities and Bethany Christian Services because of their sexual orientation.

RELATED: Catholic Charities loses Illinois same-sex adoption lawsuit

The couple were joined in the ACLU suit by a woman who spent her teenage years in the foster care system.

One of the couples, Kristy and Dana Dumont, celebrated the end of a two-year battle in a statement claiming they are “happy” that “opening… hearts and homes to a child no longer comes with the risk of being subjected to the discrimination we experienced.”

“We are hopeful that this will mean more families for children, especially those who have been waiting years for a family to adopt them,” the Dumonts said.

Other LGBTQ advocacy groups shared in the couples’ joy.

Leslie Cooper, deputy director of the ACLU LGBT & HIV Project, called the decision a “victory for the nearly 12,000 children in foster care in Michigan who need loving families.”

“Our children need every family that is willing and able to provide them with a loving home,” Cooper claimed in a press release. “When agencies choose to accept taxpayer dollars to provide public child welfare services, they must put the needs of the children first.”

Denise Brogan-Kator, chief policy officer at Family Equality Council, said the settlement recognizes that the “needs of children… must always come first.”

“Attorney General Nessel makes clear Michigan’s commitment to uphold existing nondiscrimination protections,” she said in a statement. “Furthermore, Nessel’s statement demonstrates that she understands that while religious freedom is a core American value, religious beliefs should never be used as an excuse to harm others, or in this case, to reduce the number of loving homes available to children in the Michigan child welfare system.”

However, nine states still have laws on the books giving adoption agencies a license to discriminate against gay and lesbian couples: Alabama, Kansas, Mississippi, North Dakota, Oklahoma, South Carolina, South Dakota, Texas, and Virginia.

Two more states have introduced legislation this year in an attempt to join that list: Arkansas and Tennessee.

Meanwhile, the Trump Administration has taken action to permit religious placing agencies to refuse service to prospective parents, whether it’s same-sex couples or couples of different belief systems. In February, the Department of Health and Human Services (HHS) waived nondiscrimination protections blocking a Christian adoption center turning away Catholic and Jewish parents.

Proponents of “religious freedom” laws in adoption called the Michigan settlement “tragic.”

“Thousands of children will be kept from finding the loving homes they deserve,” Becket Fund for Religious Liberty Attorney Lori Windham, who represented the defendants in the case, told the Associated Press. “This settlement violates the state law protecting religious adoption agencies.”

Michigan Sen. Majority Leader Mike Shirkey (R-Clarklake) said he was “deeply saddened and outraged” by the decision.

“Nessel’s apparent disregard for the laws of our state, the Constitution and the well-being of thousands of children is an affront to all citizens,” he told the AP, further accusing Nessel of pushing her own “personal political agenda” from the Michigan Attorney General’s Office.

Bethany Christian Services and Catholic Charities are reportedly responsible for 12 percent of adoption and foster care placements in Michigan.