Despite a dark past, today many LGBT citizens in Latin America are enjoying the right to marry, choose their gender identity and adopt children. But while laws in several of the region's biggest countries are changing, that doesn't necessarily translate into a broader societal shift toward acceptance.

Brazil's Supreme Federal Court ruled Thursday that sexual orientation and gender identity should be included in the nation's anti-discrimination law, providing a new layer of protection for LGBT people.

The decision comes at a sensitive moment in Brazil's history: Leading the country is a president, Jair Bolsonaro, who has openly expressed his disdain for same-sex couples, going so far as to say he'd prefer to have a dead son than a gay one. Studies of homicide reports indicate Brazil is the most dangerous place in the world to be transgender.

Experts say Latin America needs to address long-standing cultural biases, racial and income inequality in order to make the region safer for LGBT people. Here's a look at how far Latin America has advanced in protecting gay and transgender rights and what gaps in equality remain.

THE RIGHT TO BE GAY

Decades ago, several Latin American governments were ruled by iron-fisted governments that considered homosexuality a scourge to be silenced.

In Argentina, a far-right military dictatorship disappeared tens of thousands of suspected leftist dissidents. Advocates have long contended that gay activists suffered disproportionately, though their cases have received far less attention.

In the late 1970s during Brazil's military regime, a nascent LGBT community was similarly muted by a government with strict censorship laws that pushed gay publications and demonstrators to quit or go underground.

Cuban writer Reinaldo Arenas penned an anguishing account of the harassment and confinement he endured as a gay man in post-revolutionary Cuba, where homosexuality was seen as a remnant of the detested bourgeoisie.

Today most Latin American nations no longer consider homosexuality a crime, but in the Caribbean that is not the case. In former British colonies such as Jamaica, a law declaring the “abominable crime of buggery” punishable with up to 10 years in jail remains on the books.

Activists have presented several legal challenges and are optimistic such laws will soon be obsolete.

“In all those countries organizing is happening,” said Mauro Cabral Grinspan, executive director of the Global Action for Trans Equality advocacy group. “And I really believe that we are going to see change in the next five years.”

SAME-SEX UNIONS

Today a half-dozen nations in Latin America formally recognize same-sex marriage, with Ecuador joining the list on Wednesday.

Argentina was the first country in Latin America to approve gay unions and today has some of the most progressive LGBT policies in the world.

A handful of other cities and nations grant similar benefits but do not accept gay marriage.

There are various influences driving what scholars such as Bard College professor Omar Encarnacion refer to as “Latin America's gay rights revolution.”

He points to both a new surge in activism that followed the end of Latin America's military dictatorships and the fading sway of Catholicism.

While four of every 10 Catholics worldwide reside in the region, they are no longer a majority in several countries, according to the Pew Research Center. The number identifying as non-Catholic Christians in turn has soared.

Some worshippers are fleeing the pews entirely while others are migrating to evangelical churches offering more contemporary services.

A widening gulf from the Catholic Church has made it easier for some political and community leaders to back policies such as gay marriage.

“Unquestionably, Latin America is the champion of LGBT rights in the Global South,” Encarnacion said, referring to low- and middle-income nations.

GAY RIGHTS REVOLUTION

In a few places, the wave of activism is going beyond marriage to grant rights such as allowing more expansive definitions of gender identity and permitting same-sex couples to expand their families by subsidizing in vitro fertilization.

Argentina is particular is considered a global pioneer in expanding LGBT rights and has one of the region's most open gender identity laws. Individuals who do not identify with the gender they were assigned at birth can change it without authorization from a doctor or a judge.

More and more Latin American nations are also allowing LGBT people to serve in the military.

Before Brazil's recent Supreme Court ruling, several countries already had anti-discrimination laws on the books that included protections for gender and sexual orientation.

Javier Corrales, a political science professor at Amherst College, said despite the ruling's shortcomings it has important implications.

“It conveys to all actors the importance of respecting sexual and gender diversity,” he said. “Brazil is not the first. But it is not late.”

INTOLERANCE PERSISTS

Even as laws change, scholars and advocates are quick to note that discrimination and violence remain rampant across the region.

South American nations such as Brazil, countries in Central America and the Caribbean in particular are signaled out as poor environments for LGBT people.

According to the rights group the Grupo Gay da Bahia, 420 LGBT people were killed across Brazil in 2018, while at least 141 have been killed so far this year.

“Crime is complex,” Corrales said. “And it requires more than good laws.”

Evangelical groups that helped buoy Bolsonaro to the presidency remain an influential bloc likely to continue resisting any legislative initiatives.

Overall, it remains to be seen how strictly Brazil will enforce its anti-discrimination law.

Cabral Grinspan said many in the LGBT community are skeptical of criminalizing homophobia because it gives power to distrusted institutions like the judiciary. Rather than boosting a sense of security, the activist fears the new measure will be used as another way for police to put poor Brazilians behind bars, without addressing the root causes of violence and harassment against gay and transsexual individuals.

“It's giving more power to corrupted police institutions,” Cabral Grinspan said, “and doesn't contribute at all to social change.”

Christine Armario reports for the Associated Press.