Researchers say they’ve confirmed that it’s not sexual orientation, but rather negative life experiences that affect the long-term mental health of gay people.

Their study in Epidemiology and Psychiatric Sciences specificially mentions depression and anxiety in young to middle-aged homosexuals and bisexuals. The scientists followed thousands from those age and orientation groups over eight years, concluding that “non-heterosexual orientation was not a major risk factor for long-term mental health outcomes.”

That was after they adjusted for other known risk factors, which the researchers said gay and bisexual people were more likely to encounter than heterosexuals and which “explain most of the risk observed amongst those with a non-heterosexual orientation.”

Read: Natural Ways to Improve Your Mental Health, No Medication Required

Lead researcher Richard Burns, from Australian National University, listed those other known risk factors as “childhood sexual trauma, risky health behaviours, smoking, a lack of positive support and negative social interactions,” according to a statement from the university. “We concluded that all things being equal that there is no particular mental health risk for people with a homosexual or bisexual orientation.”

Although their sexual preference itself doesn’t play a role, statistics do show that lesbian, gay and bisexual people are more likely to attempt suicide. The Trevor Project, a suicide prevention organization, notes that young people with those orientations are four times more likely than straight kids to attempt suicide. The number is even higher for those from “highly rejecting families.” And every episode of “physical or verbal harassment or abuse increases the likelihood of self-harming behavior by 2.5 times on average.”

The Centers for Disease Control and Prevention attributes the increased risk of violence against lesbians, gays and bisexuals to “negative attitudes” and described that violence as including bullying and assault. Many of them also experienced dating violence.

The negative treatment could have a domino effect, as those youths are also more likely to abuse drugs or be absent from school, sometimes due to safety concerns or feeling uncomfortable, the CDC says. But when they are treated well, those problems are not as present: “LGB students who did not experience homophobic teasing reported the lowest levels of depression and suicidal feelings of all student groups,” including heterosexuals.

Source: Jorm AF, Burns RA, Butterworth P. The long-term mental health risk associated with non-heterosexual orientation. Epidemiology and Psychiatric Sciences. 2016.

See also:

Here are the Signs of a Panic Attack

The Wandering Mind of Mental Illness

What is the Difference Between a Psychologist and a Psychiatrist?