A recent study by the Danish Research Institute for Suicide Prevention found that suicide rates among Sweden and Denmark’s same-sex married couples decreased by 46% after both countries legalized same-sex marriage. It’s actually the second study of its kind to suggest that marriage equality reduces gay suicide rates.

The study, which was published today in the Journal of Epidemiology and Community Health, looked at suicide rates among 28,000 people who entered same-sex and opposite-sex marriages in Denmark and Sweden from 1989 to 2016. However, same-sex married people still killed themselves at more than twice the rate of those in opposite-sex marriages, Reuters reports.

Related: Just one supportive adult cuts the chance an LGBTQ youth will attempt suicide by 40%

Denmark legalized same-sex unions in 1989 and Sweden followed in 1995. Sweden then legalized same-sex marriage in 2009 and Denmark did the same in 2012.

“Legalizing same-sex marriage and other supportive legislative measures… might actually reduce stigma around sexual minorities,” said lead researcher Annette Erlangsen.

The findings of Erlangsen’s study bear some resemblance to a 2017 Harvard University study which found that suicide attempts among U.S. high schoolers decreased in states with legal same-sex marriage. After legalizing marriage equality, suicide attempts dropped 7% among straight students and 14% among gay, lesbian, and bisexual students living in those states.

It’s not really surprising that suicide rates should drop following the legalization of marriage equality. Having your love, relationships, and sexual identity legally recognized and protected reduces anxiety about social persecution. It also helps establish a solid foundation for pursuing other fulfilling life goals, such as education, career, housing, and family.

But marriage isn’t everything. A 2011 study in the journal Pediatrics found that lesbian, gay, and bisexual youth were five times more likely to attempt suicide than their heterosexuals peers, at a rate of 21.5% to 4.2%. The same study found that the risk of lesbian, gay, and bisexual youth attempting suicide was 20% greater in unsupportive environments.

As such, it’s not enough to just legalize same-sex marriage. To truly save LGBTQ lives, communities must set up supportive environments where queer people feel like valued contributors.