A gender-neutral bathroom at the University of California at Irvine. (Lucy Nicholson/Reuters)

SOME DEGREE of backlash to the Supreme Court’s legalization of same-sex marriage was to be expected. That does not excuse the actions of several Southern states over the past few weeks.

North Carolina’s leaders approved a law barring cities and towns from offering protections to lesbian, gay, bisexual and transgender people based on trumped-up fears about transgender people using bathrooms that conform to their gender identity. Transgender people make up a small and often- misunderstood group that poses no risk to bathroom users; those most injured by the bill will be children and teenagers who do not conform to traditional gender norms. And North Carolina’s lawmakers used misunderstandings and fears about transgender people to deny basic civil rights protections to gay men and lesbians, too.

Then Mississippi lawmakers passed a bill allowing businesses and government officials to refuse to serve same-sex couples seeking to marry. Particularly galling are the bill’s protections for government workers who do not want to perform their duties, such as clerks who do not want to issue marriage licenses to same-sex couples. The bill also specifically assures bakers, venue owners, photographers, DJs and others that they can turn away same-sex couples. Lawmakers argue that all they are doing is protecting religious liberty. That is misleading. No one, and certainly not the Supreme Court, is requiring pastors or other religious officials to officiate at same-sex ceremonies. But when businesses enter the public arena, they should expect to serve all customers.

Now Tennessee lawmakers have reopened debate on a bill requiring transgender students to use the bathrooms that accord to the sex they were assigned at birth.

Even as these skirmishes heat up, it is important to keep the big picture in mind. The cause of nondiscrimination has advanced rapidly over the past several years — further and faster than seemed possible only a decade ago. In 2008, politicians of all stripes, including then-Sen. Barack Obama, opposed same-sex marriage, which is now the law of the land. Given the scope of the Supreme Court ruling that established same-sex marriage in all 50 states, the backlash has been relatively muted.

Major corporations have pushed back hard against the raft of new state laws — PayPal in North Carolina, Nissan and Toyota in Mississippi, Alcoa in Tennessee. Corporate pressure persuaded Georgia Gov. Nathan Deal (R) to veto an anti-LGBT bill his legislature sent him. Pennsylvania Gov. Tom Wolf (D) signed an executive order Thursday barring discrimination on the part of state agencies and contractors.

Those pressing for essential civil protections are winning the war. But the battles they lose along the way will cause real harm to real people.