LANSING, Mich. — Gov. Rick Snyder on Thursday signed a law letting private adoption agencies with state contracts decline to participate in referrals against their religious beliefs, despite criticism that it amounts to government-sanctioned discrimination against gay couples.

The Republican told The Associated Press that the legislation codifies an existing practice within the Michigan Department of Health and Human Services, which relies on private agencies to help find temporary or permanent homes for 13,000 children in foster care at any given time.

“Our goal is to get the maximum number of kids adopted by loving families regardless of the loving family’s background, whether they’re straight or gay,” Snyder said.

Only Virginia and North Dakota now have laws that are explicit in allowing private adoption agencies to turn away prospective parents for religious reasons.

Snyder acted a day after the bills cleared the Republican-controlled Legislature almost entirely along party lines. Opponents compared the legislation – which is expected to be challenged in court – to a religious objections law in Indiana that had to be softened after a backlash.

“There is nothing about this shameful legislation that helps vulnerable kids find homes,” said ACLU of Michigan deputy director Rana Elmir, who warned that same-sex couples, religious minorities, single parents and others will be affected.

The Human Rights Campaign, said Snyder has “utter disdain” for the welfare of children and the new law would set the state back.

Michigan has 105 licensed adoption and foster care agencies, approximately 25 percent of which are faith-based.

One of the gay marriage lawsuits before the Supreme Court began as a Michigan adoption case, because the state does not allow unmarried couples to jointly adopt.