Senate Bill 522 won approval with a 21-10 vote on Tuesday, with full Republican support and all but one Democrat opposing it, the Associated Press reports.

A final vote, expected to come on Wednesday, sends it on to the state House. If passed, the bill would allow magistrates with a religious objection to gay marriage to opt out of issuing a license, provided another official is willing to step in and grant it.

If one cannot be found within the county, it proposes that documents could be sent electronically so as not to unduly delay the process.

The Texas legislature only meets once every two years, and so was unable to the U.S. Supreme Court ruling, occurring in June 2015, legalizing same-sex marriage until now.

“If we don’t do this, we are discriminating against people of faith,” said the bill’s sponsor, Sen. Brian Birdwell.

“The Texas Senate today said it has no problem with public officials picking and choosing which taxpayers they will serve,” Kathy Miller, president of the progressive activist group the Texas Freedom Network, said in a statement. “This bill opens the door to taxpayer-funded discrimination against virtually anyone who doesn’t meet a public official’s personal moral standards.”

Sen. Sylvia Garcia, a Democrat and former judge, pointed out that Texas officials have been issuing marriage licenses for nearly two years without objection, but that the bill might make some Republicans stop granting them in an attempt to win votes in conservative primary battles.

“All the clerks and judges know about the law and are following the law,” said Garcia.

She asked if the constitutional duties elected officials swear to uphold shouldn’t extend to enforcing Supreme Court decisions, and Birdwell cut her off, saying the state Senate shouldn’t engage in a “constitutional debate,” the AP reports. Birdwell said “lawmaking belongs to the legislative branch,” and not the courts.

Democratic amendments to the bill, including one that would dock the pay of those refusing to do their jobs and issue licenses, were defeated.

A similar law in Mississippi was struck down by a federal judge, and one in North Carolina, Senate Bill 2, has been challenged by plaintiffs who filed an appeal in November when their case was dismissed by a federal judge who said they lacked legal standing.