AUSTIN — The Texas House has approved a bill that would provide legal cover to adoption and foster care agencies that turn away prospective parents or refuse certain services based on the agencies' religious beliefs.

Democrats and groups advocating for lesbian, gay, bisexual and transgender rights said it amounted to state-sanctioned discrimination. Republicans heralded the bill's passage as a step forward in addressing the state's foster care crisis.

“This is a defensive bill. It allows everyone to participate,” said bill author Rep. James Frank, R-Wichita Falls. “It requires [Child Protective Services] to maintain a diverse network of homes and provides reasonable accommodations to those who are helping solve our foster care capacity crisis.”

After more than three hours of late-night debate Tuesday, the bill received final approval just before lunch Wednesday, passing by a vote of 93-49. It now heads to the Senate for further debate.

Two Republicans, Jason Villalba of Dallas and Sarah Davis of Houston, voted against the measure. Four Democrats, Terry Canales of Edinburg, Nicole Collier of Fort Worth, René Oliveira of Brownsville and Ryan Guillen of Rio Grande City voted in favor.

House Bill 3859 would apply to both taxpayer-funded and private child-placing agencies in Texas, of which roughly one-quarter are religiously affiliated. The bill would provide faith-based groups a legal defense if they're sued for denying services because of their "sincerely-held religious beliefs."

It would also prohibit the state from taking "adverse action" against such groups for placing a child in a religious school and denying a child in their care access to abortion or contraception, among other things.

"A child welfare services provider may not be required to provide any service that conflicts with the provider's sincerely held religious beliefs," the bill reads.

During debate, Frank argued that his bill did not sanction discrimination and said that providing legal cover for religious groups would translate into more homes for thousands of vulnerable children. Child welfare groups already can and do refuse to provide certain services if doing so clashes with their faith, he said.

For example, Christian Homes & Family Services, based in Abilene, considers only prospective adoptive parents who attend church weekly and have been married for two years. Buckner International, based in Dallas, will consider single people on a case-by-case basis, but lets only couples married for four years or more become foster parents.

Many have policies to turn away LGBT individuals and couples or people of other faiths. Single women are ineligible to adopt or become a foster parent through many of these groups. One rule is clear: "no trampolines."

But Frank rejected assertions that the bill would “ban” anyone from becoming an adoptive or foster parent in Texas, calling recent media reports about the bill “fabricated hysteria." He said those turned away by Christian groups have other options.

“It does not allow the providers to do whatever they want, but rather to say ‘no’ in very specific, limited circumstances,” Frank said.

"It is about specialization, not discrimination."

But Democratic lawmakers said the bill was written so broadly that it has far-reaching implications for children, prospective parents and Texas’ broken foster care system, which a judge has declared unconstitutional.

"This bill violates my deeply held religious beliefs and the separation of church and state," Austin Democrat Donna Howard said. "You're asking me to have faith that this is going to work."

Fears surfaced that Christian groups would turn away Jewish or Muslim prospective parents, or opt to place a child with a stranger rather than an unmarried or LGBT relative.

Opponents questioned why Republicans would want providers to be able to turn away eligible LGBT couples if their aim is to maximize the system's capacity. They also worried religious groups that receive taxpayer dollars would not be required to report to the state if and why they denied services to children or potential parents. Amendments to require these reports or have the bill apply only to private agencies failed.

But most of the Democratic opposition centered around concerns that the bill put the religious convictions of child welfare groups over the rights of children in their care.

“Imagine being a gay or Muslim foster child in Texas after a bill like House Bill 3859 passes. How would you know if your rights had been violated?” asked Rep. Celia Israel, D-Austin, one of two openly LGBT members of the Legislature. “The idea that kids in foster care should be political pawns is just crushing.”

Frank countered, noting the Department of Family and Protective Service's "Bill of Rights" says "as a child or youth in foster care I have the right to ... have my religious needs met." The rules were recently amended to remove explicit protections for LGBT children, according to KXAN-TV.

The bill of rights used to read, "I have the right to fair treatment, whatever my gender, gender identity, race, ethnicity, religion, national origin, disability, medical problems, or sexual orientation." The words "gender identity" and "sexual orientation" were removed in February, and the beginning was changed to, "I have the right to 'be treated fairly.' "

Chuck Smith, head of LGBT rights group Equality Texas, said the bill could put children at risk by denying children the “loving, safe and healthy home” of an LGBT individual or couple.

"The state of Texas is now one step closer to having the broadest, most discriminatory child welfare religious refusal act in the United States," Smith said.

"In the end, this was not about religious freedom."

After the vote, Frank told The Dallas Morning News it would be up to foster care or adoption agencies whether and why they turned away prospective parents. But if they did, he said, the bill requires them to refer the parents to a "secondary" provider in the same area.

He also denied allegations that his bill would allow religious groups to impose “conversion therapy,” which aims to turn gay people straight, or other harmful medical treatments on children.

"This, according to the [attorney general]'s office, isn't extending any protections that aren't already in place for these providers," Frank told The News. "It's just making it where they have something clearly written in state law. They can give it to the judge, and basically the judge looks at it and says, 'You win.' "

A handful of other states, including South and North Dakota, Michigan and Virginia, have passed similar laws. Groups such as Catholic Charities have sued elsewhere and even ended services in California, the District of Columbia, Illinois and Massachusetts, where they said state adoption and foster care laws forced them to violate their beliefs.

Encouraging religious groups to help boost the foster care system has been a political goal of Texas leaders, with first lady Cecilia Abbott and the state's CPS chief declaring it a priority. Protecting groups such as Catholic Charities from litigation through this bill would ensure they continue and increase their outreach in Texas.

CORRECTION, 1:10 p.m. May 10, 2017: An earlier version of the story didn't have the correct number of Democrats who voted in favor of the bill.