Michigan will no longer fund adoption agencies that turn away parents who are LGBT because of religious objections, a move that was part of the terms of a legal settlement announced Friday.

President Trump highlighted faith-based adoption agencies during his keynote at the National Prayer Breakfast in February. He drew attention to a family that had adopted five children through Catholic Charities, noting that the agency was defending itself in court.

Michigan’s settlement was between the state’s attorney general, Dana Nessel, and the American Civil Liberties Union, which sued in 2017 on behalf of two lesbian couples, alleging that the couples were turned away from Catholic Charities and Bethany Christian Services because they are gay. Those two agencies, according to the Associated Press, were on average doing 25 to 30 percent of the state’s foster-care adoptions as of 2015.

“Discrimination in the provision of foster care case management and adoption services is illegal, no matter the rationale,” Nessel said in a statement. “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.”

Without providing specifics, Trump promised those attending the National Prayer Breakfast that he would help faith-based adoption agencies.

“My administration is working to ensure that faith-based adoption agencies are able to help vulnerable children find their forever families while following their deeply held beliefs,” he said.

Several states have raised the question of whether adoption and foster-care agencies run by religious groups, but funded by the government, should be allowed to discriminate against parents or choose parents based on their religion or sexuality.

The Becket Fund for Religious Liberty, which represented St. Vincent Catholic Charities and others, accused Nessel and the ACLU of trying to stop the state from working with faith-based adoption agencies. Lori Windham, senior counsel at Becket, said she believes that the settlement violates a state law protecting religious adoption agencies.

“The Michigan AG and the ACLU are trying to stop the state from working with faith-based adoption agencies,” she said. “The result of that will be tragic. Thousands of children will be kept from finding the loving homes they deserve.”

In a 2017 court filing, St. Vincent Catholic Charities said it would be unable to continue its adoption and foster programs without the state contract, according to the AP.

Two plaintiffs, Kristy and Dana Dumont of Dimondale, Mich., issued a statement saying they are hopeful the settlement will result in more homes for children.

“We are so happy that for same-sex couples in Michigan who are interested in fostering or adopting, opening their hearts and homes to a child no longer comes with the risk of being subjected to the discrimination we experienced,” they said.

The issue of faith-based adoptions and funding has flared up across the country. Programs that receive federal funding through the Department of Health and Human Services, according to an Obama administration rule, are barred from discriminating on the basis of religion, gender identity or sexual orientation. A South Carolina adoption agency that works only with Christian parents petitioned for an exemption from the HHS rule and was granted one in January.