As families began planning funerals for the victims of Sunday’s rampage at a gay nightclub in Orlando, Fla., gay Americans mourned a loss that extended beyond the lives cut short.

Omar Mateen shattered the tenuous, hard-fought sense of personal safety that many gay, lesbian, bisexual and transgender Americans have begun to feel as the movement for equality has made significant gains in recent years. His bullets and the blood he left behind that early morning were a reminder that in many corners of the country, gay and transgender people are still regarded as sinners and second-class citizens who should be scorned.

While the precise motivation for the rampage remains unclear, it is evident that Mr. Mateen was driven by hatred toward gays and lesbians. Hate crimes don’t happen in a vacuum. They occur where bigotry is allowed to fester, where minorities are vilified and where people are scapegoated for political gain. Tragically, this is the state of American politics, driven too often by Republican politicians who see prejudice as something to exploit, not extinguish.

Since the 1990s, gay, bisexual and transgender Americans have made considerable progress in the fight for equality under the law. By living openly and proudly, they have changed society’s attitudes about sexual orientation and gender identity. That shift has prompted politicians who were once wary about embracing equal rights for L.G.B.T. Americans — including President Obama and Hillary Clinton, the presumptive Democratic presidential nominee — to become resolute allies. The 2015 Supreme Court ruling that legalized same-sex marriage was celebrated by many in the gay community as the crowning achievement of a decades-long quest for respect and dignity.

Yet, that fight remains far from over. Since the marriage ruling, several Republican-led state legislatures and Republican governors and federal lawmakers have redoubled their fight against legal protections for people on the basis of sexual orientation and gender identity. So far this year, more than 200 anti-L.G.B.T. bills have been introduced in 34 states.

Donald Trump, unlike some other prominent Republicans, called the Orlando massacre what it was: an attack on gay people. Mitch McConnell, the Senate majority leader, could not even offer that recognition to a community in pain.

Yet, Mr. Trump has vowed to choose Supreme Court justices who would overturn marriage equality, and he supports the deceptively named First Amendment Defense Act, an effort to approve discrimination against gay and transgender people nationwide under the guise of religious freedom. And Mr. Trump backtracked from his statement that transgender people should be able to use the restroom consistent with their gender identity after Senator Ted Cruz used his words to attack him during the nomination fight.

That restrooms have become such a fixation, particularly at the state level, is a worrying reminder of the entrenched stigma the community continues to face. The loudest advocates of this odious effort have been Gov. Pat McCrory of North Carolina and Gov. Greg Abbott of Texas, who has worked in lock step with the Texas attorney general, Ken Paxton. Meanwhile, Gov. Phil Bryant of Mississippi in April signed into law a bill that allows discrimination against L.G.B.T. people in schools and the workplace.

It’s hard to say how many politicians take these positions as a matter of principle and how many do so because it has proved to be an effective way in the past to raise money and turn out the vote. As the funerals are held for those who perished on Sunday, lawmakers who have actively championed discriminatory laws and policies, and those who have quietly enabled them with votes, should force themselves to read the obituaries and look at the photos. The 49 people killed in Orlando were victims of a terrorist attack. But they also need to be remembered as casualties of a society where hate has deep roots.