Opponents of the law, led by Jared Woodfill, a Houston lawyer and a Texas Republican Party leader, started a well-funded campaign that equated supporting it with allowing men to use women’s public restrooms for deviant purposes. Their fearmongering, blasted on yard signs, bellowed from church pulpits and dramatized in a television ad, suggested that sexual deviants were waiting for the ordinance to kick in to sneak up on unsuspecting women in bathroom stalls.

This is completely unfounded. There are no documented cases of peeping Toms or rapists taking advantage of anti-discrimination ordinances that have extended legal protections to transgender Americans in recent years. San Antonio passed a similar ordinance in 2013 that expanded civil rights without driving up criminal assaults. And of course, no one expects that Houston perverts, after Tuesday’s lamentable result, will now drive down to San Antonio to corner women in restroom stalls.

While the defeat of HERO is a painful setback, it is encouraging that the broader quest for equality for gay and transgender Americans is advancing steadily. On Monday, the Department of Education backed a transgender student in Illinois who is fighting for the right to use restrooms and locker rooms on campus like any other female student. It was the federal government’s latest action in a civil rights movement that is redefining how the nation views, and treats, transgender Americans.

When that movement achieves irreversible momentum — and it is a matter of when, not whether — people like Mr. Woodfill, Mr. Abbott and Mr. Patrick will be remembered as latter-day Jim Crow elders. Their demagogy is egregious because it preys on some of the most vulnerable people in our society.

As opponents of the ordinance celebrate their victory this week, transgender people across the country are understandably reeling. They should take comfort in knowing that history will not be kind to the haters who won on Tuesday. In time, the bigots are destined to lose.