A day after President Trump tweeted out that he wanted to ban transgender troops from serving in the US military, Chinese LGBTQ activists celebrated a landmark victory — a court ruling in favor of a transgender man in the country’s first transgender discrimination lawsuit.

The 29-year-old man, who goes by Mr. C to protect his family and girlfriend’s privacy, said on Thursday that a court in the southwestern city of Guiyang ruled that his rights had been violated when his employer fired him in 2015 because of his gender identity.

“We hope, through this case, people in similar situations will realize they have a right, and we hope it will eventually result in a workplace anti-discrimination law,” Mr. C told the Associated Press.

Mr. C was hired for a sales job at Ciming Health Exam Center, a health care services center in China’s Guizhou province, in April 2015. But just eight days later, he was fired.

In an interview with the New York Times in 2016, Mr. C said that the company’s human resources manager complained that he dressed like a gay man and said he might damage the company’s reputation.

Mr. C took his case to court, saying he was unlawfully fired. In December 2016, the court ruled that the company should pay Mr. C but also said that there was no proof that his firing was a result of discrimination.

The latest court ruling said that Mr. C’s rights were violated and ordered Ciming to pay him the equivalent of $297. The court also said workers should not be discriminated against “based on their ethnicity, race, gender or religious beliefs,” reported the Washington Post.

“Short of a formal apology from Ciming, I think this lawsuit has achieved its purpose,” Mr. C told the AP on Thursday.

China’s LGBTQ community hasn’t had many legal victories. Until now.

Homosexuality was decriminalized in China in 1997 and declassified as a mental disorder by the Chinese Society of Psychiatry in 2001.

But at the same time, the government has restricted LGBTQ activism. Last month, the government released a new regulation banning any display of “abnormal sexual behaviors” online. And in May, authorities abruptly canceled a planned LGBTQ conference in central China.

A 2016 study by the United Nations Development Program found that only 5 percent of China’s LGBTQ population is open about their identity at work or school, and 17 percent out to their families.

China’s LBGTQ community has been trying to change that in a series of landmark legal cases but until now has lost almost all of them.

In 2016, a Chinese court rejected a gay couple’s request to be married in the country’s first same-sex marriage case. And in 2015, a lesbian student activist sued the Ministry of Education over textbooks that described homosexuality as a disorder, but the court denied her case.

Even though Mr. C’s case is one of the few where LGBTQ communities notched a win, the legal battles have still sparked conversations throughout the country about gay and transgender rights.

There are also some signs that the Chinese public is becoming more accepting of the country’s LGBTQ community. A 2015 poll by WorkForLGBT, a Chinese advocacy group, found that 77 percent of people believe that workplaces should be “welcoming of all, regardless of sexual orientation.”

One of this year’s most popular “boy bands” in China, Acrush, is actually made up of five gender-neutral women. The group’s fan page on Weibo, the Chinese version of Twitter, has more than 700,000 followers.

For his part, Mr. C has said he will keep fighting for equality. “Although the case has ended, we still have a long way to go,” he told the Washington Post.