Legislators in the nation's largest conservative state of Texas sought Tuesday to chip away at the landmark Supreme Court decision legalizing gay marriage, voting to let county judges and other elected officials recuse themselves from issuing marriage licenses if they have personal religious objections.

The bill won preliminary approval in the Senate 21-10, with full Republican support and all but one Democrat opposing it. A final vote, expected to come Wednesday, sends it to the state House.

State Capitol Building in Austin, Texas Heather Drake / Loop Images/UIG via Getty Images

Texas' Republican-controlled Legislature only meets every two years, meaning state lawmakers weren't able to respond to the high court's June 2015 gay marriage decision until now. Should the bill become law, however, it will almost certainly be challenged as unconstitutional by federal lawsuits.

"If we don't do this, we are discriminating against people of faith," said the sponsor, Sen. Brian Birdwell, a Republican from Granbury about 40 miles southwest of Fort Worth. He was referring to clerks, judges, justices of the peace and other elected officials empowered to issue marriage licenses in Texas' 254 counties.

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

Opponents say it sanctions discrimination and defies the nation's highest court.

"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."

Birdwell's hotly debated proposal only applies in cases where other officials without objections agree to step in for the recusing party. If the substituting official is located outside the county where the marriage license is being sought, documents could be sent electronically so as not to unduly delay the process.

Related: Dozens of Proposed Anti-LGBTQ Bills Target Kids and Families

Republican Texas Attorney General Ken Paxton initially caused confusion by issuing a non-binding opinion following the 2015 Supreme Court ruling, suggesting that county clerks statewide who objected to gay marriage for religious reasons could refuse marriage licenses to same-sex couples. But, after civil groups threatened lawsuits, gay couples soon were being married across the state without incident.

Sen. Sylvia Garcia, a Houston Democrat and former judge, said Tuesday that the law was unnecessary since Texas officials have been issuing marriage licenses for nearly two years without objection. She said the bill will let many Republican officials now stop doing so, not because they have legitimate, religious-based problems with gay marriage but because they want to take ideological stands that will impress local primary voters.

"All the clerks and judges know about the law and are following the law," said Garcia, who also asked if the constitutional duties elected officials swear to uphold shouldn't extend to enforcing Supreme Court decisions. Birdwell cut her off, saying the state Senate shouldn't engage in a "constitutional debate." He added that "lawmaking belongs to the legislative branch," not the courts.

Related: Meet the Law Firm Behind Many of the Anti-Trans 'Bathroom Bills'

The Senate defeated Democratic amendments seeking to weaken the bill, including one that would have docked the pay of county clerks refusing to issue gay marriage licenses.

Laws similar to Texas' haven't survived court challenges in other states. Last summer, a federal judge struck down a provision in a Mississippi law that had allowed county clerks to recuse themselves from issuing gay marriage licenses because of religious objections.

Follow NBC Out on Twitter, Facebook and Instagram