Allowing same-sex couples to marry leads to a significant drop in the rates of suicide in gay and lesbian people. That’s the findings of a major survey carried out in Sweden and Denmark.

Both European countries were early adopters of same-sex marriage (Denmark legalized it in 1989), which means researchers were able to analyze a large data pool. The study tracked more than 28,000 people in same-sex unions for an average of 11 years.

They looked at the suicide rates among those entering same-sex marriages between 1989 and 2002, and then between 2003-2016. The suicide rate fell by 46% between the two samples.

It’s been noted in other studies that married people – of all sexualities – are less likely to die by suicide, and the suicide rate in both countries has fallen in recent years. In the same study, the suicide rate for those in opposite-sex marriages fell by 28% between – still significant but not as great as the figure for those in same-sex relationships.

Related: Gay men who get married live longer, but not lesbians

In their conclusion, the researchers note: “Although suicide rates in the general populations of Denmark and Sweden have been decreasing in recent decades, the rate for those living in same-sex marriage was declining at a steeper pace, which has not been noted previously.”

Although some other factors may be at play (for example, more effective treatment for HIV has also led to a drop in suicide among gay men) they believe that legalizing same-sex marriage has helped to decrease prejudice towards gay and bisexual people.

“Being married is protective against suicide,” said Annette Erlangsen of the Danish Research Institute for Suicide Prevention and one of the study’s co-authors.

“Legalizing same-sex marriage and other supportive legislative measures – they might actually reduce stigma around sexual minorities,” she told Thomson Reuters Foundation.

This isn’t the first study to suggest a link between marriage and a drop in LGBTQ suicides. A Harvard University study in 2017 found that suicide attempts by gay, lesbian and bisexual US High School students dropped 14% in those states with legal same-sex marriage.

The Swedish and Danish study wasn’t all good news, though. People in same-sex marriages were still 2.3 times as likely to kill themselves as those in opposite-sex marriages – with gay men more likely than any other group. Tackling stigma and prejudice still has some way to go.

Related: The Trevor Project launches 24/7 chat and text services