LONDON (Thomson Reuters Foundation) - Homophobia has risen in European countries that do not legally recognize same-sex relationships, while acceptance of gay and lesbian people has jumped in states where they can marry, research released on Wednesday showed.

Most European countries saw a rise in acceptance of same-sex relationships between 2002 and 2016, according to Hungarian researchers who analyzed results from the European Social Survey, carried out every two years.

However, Russia, Bulgaria, Lithuania, Poland and Ukraine all saw acceptance of gay and lesbian people decrease over the 14-year period.

“I think it is very important that we can unlearn prejudice,” said Judit Takacs, a researcher at the Hungarian Academy of Sciences and one of the study’s authors.

“It’s a very serious message that you can learn to be ... open minded, and you can learn to be intolerant,” she told the Thomson Reuters Foundation.

Same-sex marriage is legal in 16 out of 48 European countries, according to ILGA, a Europe-wide LGBT+ advocacy group, while 21 European countries do not allow same-sex marriage or civil partnerships.

The European Social Survey asked participants to rate their agreement with the statement “gay men and lesbians should be free to live their own life as they wish” on a scale from 1-5.

Russia scored the lowest in 2016, with an average of two, and the highest scores came from Belgium, Spain, Norway, France, Sweden, the Netherlands and Iceland.

Spain and Portugal, where gay marriage is legal, and Cyprus, Italy and Greece, which allow same-sex civil partnerships, saw the biggest positive changes, according to the analysis of 334,000 survey answers.

The study did not show whether legalizing same-sex marriage caused a decrease in homophobia, but Takacs said legislation could help to normalize same-sex relationships.

“It highlights the role of the state. It’s a great responsibility of our politicians how they lead us, and what kind of messages they sponsor,” Takacs said.

“You can see how for example, in my country the Orban regime they organize this propaganda message about migrants or against gays and lesbians. And it works.”

Hungary’s Prime Minister Viktor Orban opposes equal rights for same-sex couples while also advocating for gay and straight people to co-exist quietly.

Hungary allows same-sex couples to enter a civil partnership, but not to marry or jointly adopt a child.

Yuri Yoursky of the Eurasian Coalition on Male Health, a group that campaigns for better HIV treatment and prevention for gay and bisexual men and transgender people, said he felt safer after leaving Ukraine.

“Moving to Estonia where there is a law of civil partnership, I feel more secure, more respected,” he said.