From bathrooms and beauty pageants to diplomatic disputes and Donald Trump's U.S. presidential victory, 2016 was a turbulent year for lesbian, gay, bisexual, transgender and queer (LGBTQ) people worldwide.

Gay and transgender rights took more prominence than ever in the global media spotlight after several high-profile legal battles, and celebrity and cultural endorsements.

Yet LGBTQ people worldwide still face discrimination in many aspects of life such as employment, education and health care, and are subjected to widespread violence, advocates say.

However, gay and transgender rights groups are being increasingly backed, and are fighting to change policies and laws to protect LGBTQ people from violence and discrimination.

Here are five of the biggest gains for LGBTQ rights in 2016:

1) United Nations appoints first LGBTQ rights investigator

Vitit Muntarbhorn speaks with the UN press corps. Albin Lohr-Jones - Pacific Press / LightRocket via Getty Images

The United Nations in September appointed its first LGBTQ rights independent investigator to help protect sexual and gender minorities worldwide from violence and discrimination.

Vitit Muntarbhorn's three-year role was created by the U.N. Human Rights Council amid objections by Muslim countries, and several African states who sought to have his work suspended.

Yet Muntarbhorn told the Thomson Reuters Foundation that even those countries perceived as the most virulent opponents of LGBTQ rights may in fact have pockets of openness and tolerance.

RELATED: United Nations Narrowly Votes to Keep LGBTQ Envoy

Muntarbhorn, an international law professor who has served on many U.N. bodies, including inquiries on Syria and as a special rapporteur on North Korea, also said he does not see his task in terms of how many people he might represent worldwide.

"One person might be affected 10, 20, 100 times ... bullied at a young age, can't go to toilet, laughed at, tortured, ultimately killed and defamed at the same time," Muntarbhorn said. "How many violations can you count?"

2) Malta bans conversion therapy to lead way in Europe

View of the Parliament House in Valletta, Malta, 21 October 2015. Horacio Villalobos / Corbis via Getty Images

Malta became the first country in Europe to ban conversion therapy, a much-criticized and discredited practice that aims to change sexual orientation, gender identity or gender expression.

The southern Mediterranean island nation criminalized conversion practices -- often referred to as "gay cure" therapies -- with its parliament calling it a "deceptive and harmful act".

Those who prescribe or perform the therapy can be punished with fines of up to 10,000 euros ($10,400) and one year in jail.

Malta is widely considered as one of the most progressive nations in Europe when it comes to LGBTQ rights, having made a raft of legal and social changes in recent years.

It has introduced LGBTQ-inclusive education, passed same-sex civil unions and allowed transgender people to change their legal gender without any medical or state intervention.

Conversion therapy is still legal in most countries worldwide, but has been banned in several American states.

3) U.S. celebrities, corporations boycott North Carolina over trans bathroom law

Unisex signs hang outside bathrooms at Toast Paninoteca on May 10, 2016 in Durham, North Carolina. Sara D. Davis / Getty Images

Entertainers such as Bruce Springsteen and companies ranging from PayPal to Deutsche Bank have pulled events and jobs from North Carolina to protest a law restricting bathroom access for transgender people in government buildings and public schools.

North Carolina in March became the only state in the country to require transgender people to use state-owned public restrooms and changing facilities that correspond with the sex on their birth certificate rather than their gender identity.

RELATED: Incoming North Carolina Governor Vows Repeal of Controversial LGBTQ Law

Transgender rights have become an increasingly divisive issue in the United States, and the use of public bathrooms has been a flashpoint in the controversy over the past year.

Republican lawmakers cited privacy and security concerns when they passed the law, but critics say the bill, which also blocks local measures protecting LGBTQ people from discrimination, is stigmatizing, insulting and unconstitutional.

North Carolina Governor Pat McCrory earlier this month conceded the state's contested gubernatorial race to Democrat Roy Cooper, four weeks after the Nov. 8 election that many saw as a referendum on the transgender bathroom law.

4) Belize scraps colonial-era anti-homosexuality law

Belize LGBTQ Activist Caleb Orozco Caleb Orozco

Belize's Supreme Court in September ruled that a colonial-era law criminalizing homosexuality was unconstitutional, in a judgment LGBTQ activists say will boost efforts to abolish anti-gay laws in other former British colonies in the Caribbean.

The law, which punished gay sex with up to 10 years in prison, was scrapped after years of advocacy by the gay rights activist Caleb Orozco of the United Belize Advocacy Movement.

RELATED: Belize Supreme Court Overturns Anti-Gay Law

Belize became the third country to decriminalize gay sex in 2016, along with the South Pacific island of Nauru and the Seychelles, an Indian Ocean archipelago, according to the U.S.-based Human Rights Campaign.

Yet it remains illegal in more than 70 countries worldwide, most of which are former British colonies, the gay rights group said.

5) Beauty pageants, film industry shine spotlight on LGBTQ issues

From the first openly lesbian Miss America contestant and Israel's inaugural transgender beauty pageant to Emmy awards for the hit transgender TV series "Transparent", the entertainment industry is shining a bigger spotlight on LGBTQ stars and issues.

The popularity of shows in recent years like "Orange Is the New Black" and movies such as "The Danish Girl", which feature transgender stars or focus on issues facing gay and transgender people, have seen LGBTQ rights become mainstream in the media.

Yet this success comes amid controversy within the LGBTQ community over how transgender people are portrayed, and over the casting of straight men and women in transgender roles.

"I would be happy if I were the last cisgender male to play a transgender female," actor Jeffrey Tambour said in September in his acceptance speech after winning an Emmy for his portrayal of transgender woman Moiré Pfeiffer in "Transparent."

Follow NBC Out on Twitter, Facebook and Instagram.