MONTGOMERY, Ala. — Alabama lawmakers on Tuesday gave final approval to a bill protecting faith-based adoption organizations that refuse to place children with gay parents, or other households, because of their religious beliefs.

The legislation would prohibit the state from refusing to license faith-based adoption groups that refuse placements because of their religious beliefs.

Guido Mieth / Getty Images

Proponents argued that the measure is needed to make sure adoption groups can operate without being forced to violate their religious beliefs, while critics, including the state's only openly gay lawmaker, called it blatant discrimination.

The Alabama House of Representatives voted 87-0 to go along with a Senate change to the bill. The legislation goes to Gov. Kay Ivey for her signature. The governor hasn't said whether she'll sign it.

The Morning Rundown Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

"It's just making sure the faith-based child placing agencies aren't discriminated against due to their beliefs. It's not discriminating against anyone else," Rep. Rich Wingo, the Republican sponsor of the bill, said.

The bill's protections would apply only to private agencies that do not accept state or federal funds. Wingo said the bill would protect faith-based groups such as Agape and Baptist Children's Homes, which do adoption and foster care placements.

State Rep. Patricia Todd, the state's only openly gay lawmaker, said placements should be made on the best interest of the child and not on "some artificial demographic."

"We have too many kids in foster care who need adoption, many of them with special needs. Same-sex parents want to adopt and take care of those children," said Todd, D-Birmingham.

Related: My Experience With Second-Parent Adoption as a Same-Sex Couple

Todd said she voted to go along with a Senate change that said the protections wouldn't apply to agencies that accepted state funds

South Dakota, Michigan, North Dakota and Virginia have passed similar laws.

David Dinielli, deputy legal director of the Southern Poverty Law Center, a Montgomery-based civil rights group, called the legislation "prejudice cloaked in religion."

"This law limits the number of homes available to Alabama's most vulnerable kids by allowing foster and adoption agencies to turn away parents who don't fit with the agencies' religious beliefs, including parents who are unmarried, divorced, Muslim, LGBT or even Christian," Dinielli said.

Follow NBC Out on Twitter, Facebook and Instagram