The Japanese supreme court has ruled in favor of a law that requires transgender people to get sterilized in order to update their documents.

The case was brought by Takakito Usui, a trans man who wanted to update his papers but was told that he couldn’t because of a 2004 law that requires a trans person to have “a body which appears to have parts that resemble the genital organs of those of the opposite gender.”

“The essential thing should not be whether you have had an operation or not, but how you want to live as an individual,” Usui said.

He appealed, but lost when a four-judge panel unanimously agreed that the law was constitutional.

The court ruled that the government had an interest in limiting societal “confusion” and “abrupt changes.”

Related: Japanese elects its first out transgender man to public office

Moreover, they stressed that sterilization is a purpose of the law, since there may be “problems” in parent-child relationships if transgender people could have children.

That same law also requires that a transgender person be single and have no children under the age of 20 in order to have their gender identity recognized by the state.

The judges, though, agreed that the law appears invasive and suggested that the legislature review it.

In a concurring opinion, Judge Mamoru Miura wrote, “Suffering related to gender, felt by people with gender identity disorder, is also the problem of society as a whole, which should encompass the diversity of sexual identity.”

The World Health Organization condemns the practice of forced sterilization.