A supporter of same-sex marriage waves his rainbow flag in front of the U.S. Supreme Court in Washington, D.C., in this file photo from April 2015. (Astrid Riecken/The Washington Post)

Lawmakers in several states are introducing bills aimed at allowing religious people and businesses to refuse to provide services that conflict with their faith — measures that rights groups say are thinly veiled efforts to legalize discrimination against gay and transgender people.

More than a dozen states have seen bills this year that seek to codify discrimination, from allowing adoption agencies to refuse placements with same-sex couples to allowing businesses to turn away customers based on their views of same-sex marriage or homosexuality. Such bills have been a staple of legislative sessions in conservative states since the U.S. Supreme Court legalized same-sex marriage in 2015, but they have drawn renewed attention this year because of comments from President Trump suggesting that the nation’s religious liberties eroded considerably during Barack Obama’s presidency.

Last week, Trump declined to sign a sweeping executive order that would have given businesses and individuals of faith broad leeway to opt out of laws that conflict with their religion. Socially conservative groups remain hopeful — and rights groups remain fearful — that some form of that directive will eventually go into effect. In the meantime, states are poised to enact more modest versions within their own borders.

A committee of the Alabama House on Wednesday advanced the “Child Placing Agency Inclusion Act,” a bill that would give faith-based adoption and foster agencies the right to use their religion to guide their child-placement decisions. Religiously affiliated agencies in Alabama already have the right to discriminate in placements, and such agencies are responsible for about a third of the state’s foster and adoptive placements. But the bill serves as a preemptive strike in case of lawsuits or legislation that might curb that right, said Rep. Rich Wingo, a Republican from Tuscaloosa.

“That’s coming here too, we all know that, and so this bill for us is a preventative step forward to be proactive,” Wingo said. “This bill is not to prohibit gay or lesbian couples from adopting or fostering, it says do not discriminate … against us based on our religious belief.”

In some states and cities, wedding vendors who refuse to bake cakes or provide flowers for same-sex unions have run afoul of anti-discrimination laws, facing fines or other sanctions. Catholic Charities has clashed with some states over requirements that they allow adoptions to same-sex couples, leading them to halt adoptions in Illinois, Massachusetts and the District, according to the Alliance Defending Freedom, a Christian legal organization.

Samuel McLure, owner of the Adoption Law Firm in Alabama, testified in favor of the bill in Montgomery. As a Christian, he does not assist same-sex couples, he said. He worries that faith-based agencies that have state contracts might drop out of the adoption business rather than act against their beliefs, and that fewer agencies in the market would hurt vulnerable children in need of homes.

“The Inclusion Act is about making sure that a third of the children in foster care can be served,” he said.

The passage of the bill out of the House Health committee Wednesday drew a sharp rebuke from the Human Rights Campaign, a national gay rights group.

“This effort to discriminate using taxpayer dollars is an embarrassing and dangerous distraction from the real problems facing Alabama,” Eva Kendrick, Alabama state director for the group, said in a statement. The organization “opposes this noxious bill and any attempt to make life more difficult for Alabama’s LGBTQ families and youth — especially children in out-of-home care due to crisis, abuse and neglect.”

Similar bills have been introduced in Oklahoma and South Dakota, according to the American Civil Liberties Union. North Dakota, Virginia and Michigan already have such protections on the books.

Alabama this year also is considering a bill that would allow doctors and other medical personnel to opt out of treatments that conflict with their faith, such as gender-reassignment therapy and surgery.

Oklahoma lawmakers are mulling a broader proposal to let organizations, individuals and certain businesses refuse services if doing so conflicts with their beliefs about a “marriage, lifestyle, or behavior.”

And a Texas measure would allow any licensed professional to refuse to serve a person if doing so conflicts with their faith. According to the ACLU, that could mean a teacher or a social worker could refuse to help a student because he or she is gay.

Eunice Rho, advocacy and policy counsel with the ACLU, said conservatives appear to be trying to chip away at marriage rights on the margins using a variety of strategies, just as they have been doing on abortion rights. She said the ACLU and other rights groups are now trying to “maintain a baseline” that assumes that government officials, individuals, organizations and businesses of faith must adhere to the same laws as everyone else.

“Maintaining that baseline is honestly fundamental to make sure that the rights that LGBT people have are actually rights in practice and not just on paper,” she said.

But Kellie Fiedorek, legal counsel for Alliance Defending Freedom, a Christian legal organization that advises states on matters of religious freedom, said the nation has in fact seen “the pendulum swing further and further to the left” in recent years. “There’s an effort now to say, wait a minute, no one should be driven from public life or banned from their professions simply because of their beliefs.”