Even with Mr. Rosselló’s reversal, the fact that the bill had advanced at all — and that lawmakers could still reintroduce it — left many people worried about the future of gay rights on the island.

“In Puerto Rico, L.G.B.T. and women’s rights have come a long way in recent decades,” said Amarilis Pagán, an activist for women’s rights and L.G.B.T. rights. “This is simply a response — a backlash — by these groups from the ultraright to stop those advances.”

Puerto Rico has tried to foster a gay-friendly reputation, marketing itself that way to tourists. Employment discrimination based on gender or sexual orientation is banned. Following a court ruling last year, people have been able to change the gender listed on their birth certificates. Last weekend, San Juan hosted its first trans pride day.

But Roman Catholic and evangelical Christian churches wield a great deal of influence on the island, and religious conservatives have close relationships with some local politicians who have pushed the bills that L.G.B.T. leaders have opposed. And a wave of violence on the island has not spared L.G.B.T. people: Earlier this year, Kevin Fret, who billed himself as Puerto Rico’s first gay Latin trap artist, was fatally shot.

“This has served as a reminder that some of these advances are at risk, that there is still discrimination, that there is still homophobia,” said Pedro Julio Serrano, an activist in San Juan. “We can’t forget that.”

Against that backdrop, members of the island’s L.G.B.T. community have tried to focus on rebuilding the bars, art and performance venues lost to Hurricane Maria while being forced to keep a wary eye on politics.