A bill that would let faith-based adoption and foster care agencies decline to place children with gay, lesbian and transgender households is headed to Gov. Greg Abbott.

The Texas Senate voted 21-10 to approve House Bill 3859 early Monday. All Republicans voted for the bill, along with one Democrat, Sen. Eddie Lucio Jr. of Brownsville.

"Such an imbalance of rights not only could leave these children worse off than they are now; it opens the door to blatant discrimination against children and loving parents who might not share the same beliefs as some foster care providers," Sen. Kirk Watson, D-Austin, said before the vote. "It’s a shame that this is being done in the name of child protection."

TEXAS POLITICS DELIVERED EVERY DAY: Sign up for our Texas Politics email

Sen. Charles Perry, R-Lubbock, who has a similar measure pending in the Senate, said that HB 3859 would protect the free practice of religion while keeping essential faith-based organizations in the child welfare system, which is plagued by a shortage of homes for children who have been abused or neglected.

He said that if the bill did not pass, it could mean a potential loss of 25 percent of child placement agencies, some of whom have suspended services for fear of being sued for exercising their religious freedoms.

"The state should embrace a diversity of providers," Perry said. "The right of religious freedom seems to be under persecution."

Perry said that in other states, agencies have been sued over refusing to place children with certain families based on religious objections, but no such lawsuits have been filed in Texas.

Opponents said the bill irresponsibly excludes eligible foster parents, especially as children are still forced to sleep in state offices because of a shortage of foster homes.

Between Sept. 1 and March 31, 314 children slept in state offices, hotels, shelters and other temporary housing for at least two consecutive nights, according to the Texas Department of Family and Protective Services.

During the same period the previous year, 83 foster children were at some point in such living arrangements.

Critics say the bill would allow for state-sanctioned discrimination under the guise of religion, favoring conservative Christian beliefs — and potential objections to non-Christian, single or LGBT Texans — over the welfare of children.

"I’m concerned it’s about protecting agencies and not the interest of the child," Sen. Sylvia Garcia, D-Houston, said. "You basically give them a pass."

READ: New legislative tactics brought to old fight over religion

Garcia and Sen. José Menéndez, D-San Antonio, also had concerns that foster children would not receive necessary medical attention, vaccinations and access to contraceptives and abortions based on foster parents’ religious beliefs.

Perry said that the bill would ensure that no foster children would be denied medical care.

Democrats attempted to tack on a half-dozen amendments that would have ensured that foster children’s rights, including based on their sexual orientation or gender identity, were prioritized over that of the agencies, but they failed.

"No amount of discrimination is acceptable. There is no middle ground. All discrimination is bad, full stop. Targeting some of the most vulnerable children in our state is abhorrent, shameful and disgraceful," said Chuck Smith, head of Equality Texas.