A South Korean court has ruled that the military unlawfully discriminated against the country's first known transgender soldier by discharging her for undergoing gender reassignment surgery.

The landmark verdict came seven months after Byun Hui-su was found dead at her home.

Activist groups said the decision by the Daejeon District Court advances the rights of sexual minorities but also described it as delayed justice for Byun Hui-su, who had protested against the army's decision to force her out.

South Korea prohibits transgender people from joining the military but has no specific laws on what to do with those who have sex reassignment operations during their time in service.

Byun Hui-su, who had been a staff sergeant and tank driver, was discharged in January 2020 after the army concluded that her operation could be a reason for dismissal.

The army then cited a law that allows the military to discharge personnel with physical or mental disability if those problems did not result from combat or in the line of duty, and said Byun Hui-su's loss of male genitals amounted to a disability.

Byun Hui-su, who said she had sex reassignment surgery in Thailand in November 2019 after suffering depression over her sexual identity, expressed a desire to continue serving but a military panel rejected her appeal.

She filed a lawsuit against the military in August 2020, and her relatives inherited the suit after she was found dead at her home in the central city of Cheongju in March this year.

The Daejeon court said the army's decision to discharge Byun Hui-su could not be legally justified because it was based on an assertion that she was male.

The court pointed out that the army already knew Byun Hui-su had applied to the Cheongju District Court to change her legal status as a woman before it decided to discharge her.

The Cheongju court granted Byun Hui-su's request weeks after she was discharged.

"In deciding whether Byun Hui-su's case could be interpreted as a physical and mental disability as defined by the military personnel law, it's obvious that the decision should have been based on the premise that (Byun Hui-su) was a woman following gender reassignment," the Daejeon court said in a statement explaining its ruling.

"Therefore, the (army's) conclusion that Byun Hui-su's loss of (her male genitals) amounted to physical and mental disability, which was based on the premise that Byun Hui-su was male even after gender reassignment surgery, is undoubtedly illegal and should be cancelled," it said.

Byun Hui-su's plight struck a nerve in a deeply conservative country where transgender people and other sexual minorities often face harassment, abuse and discriminatory treatment, leaving many fighting depression.

A coalition of human rights groups, including the Centre for Military Human Rights Korea, issued a statement saying that the ruling created hope for sexual minorities and urged the military not to appeal.

"Staff Sgt Byun Hui-su should be smilingly brightly now after the court victory and going back to her colleagues, but she is no longer here," the statement said.

"The ruling today is a legal triumph that that corrected unjust discrimination, but it's also a painful lesson in delayed justice."

In a text message sent to reporters, the army said it respects the court's ruling and will hold "comprehensive" discussions on how to respond.

The army said it has not decided whether to appeal.

At the time of Byun Hui-su's death, Seoul's Defence Ministry expressed condolences but said the military had no ongoing discussions about allowing transgender people to serve.