In a move slammed by civil rights groups, South Dakota on Friday enacted a law that shields private agencies from being sued for discrimination for refusing to place adoptive and foster children with gay couples on religious grounds.

Republican Gov. Dennis Daugaard's signing of the bill, SB-149, makes South Dakota the first state to take such a step since the Supreme Court legalized same-sex marriage in 2015, the Associated Press wrote.

According to the AP, Daugaard said he feared "private child-placement agencies acting in the best interest of a child could be subject to a lawsuit when denying placement to someone in a 'protected class,' such as members of the LGBT community."

Daugaard, as quoted in the Argus-Leader, explained, "Whether it's the state acting directly or through an agency, we need to do everything we can to encourage those agencies to stay in this business and help us find those placements," Daugaard said.

SB-149 says no child-placement agency can be required to provide any service that conflicts with "any sincerely-held religious belief or moral conviction."

Human Rights Campaign Legal Director Sarah Warbelow said in a statement that the law "not only puts the best interests of the more than a thousand vulnerable children served by South Dakota's foster care system at risk," but "signals the potential of a dark new reality for the fight for LGBTQ rights."

HRC said agencies will now be at liberty to turn away not only same-sex couples, but "interfaith couples, single parents, married couples in which one prospective parent has previously been divorced" and others.

The bill's sponsor, Republican state Sen. Alan Solano, told the AP he was concerned that without protections, faith-based child-placement agencies might stop offering adoption services as organizations in California, Illinois and Massachusetts did after those states banned discrimination based on sexual orientation.

Michigan, North Dakota and Virginia, per the AP, already have similar laws on the books.

Libby Skarin, policy director of the ACLU of South Dakota, was quoted in the Washington Blade as saying she was "deeply disappointed" Daugaard signed the bill into law.

"This discriminatory legislation takes South Dakota in the wrong direction, and sends the message that our leaders are more concerned with the desires of religious agencies than the rights of individuals and children in our state," Skarin said.