TOKYO -- Human rights and LGBT activists on Friday denounced a ruling by Japan's Supreme Court upholding a law that effectively requires transgender people to be sterilized before they can have their gender changed on official documents.

The court said the law is constitutional because it was meant to reduce confusion in families and society. But it acknowledged that it restricts freedom and could become out of step with changing social values.

The 2004 law states that people wishing to register a gender change must have their original reproductive organs, including testes or ovaries, removed and have a body that "appears to have parts that resemble the genital organs" of the gender they want to register.

More than 7,800 Japanese have had their genders officially changed, according to Justice Ministry statistics cited by public broadcaster NHK.

The unanimous decision by a four-judge panel, published Thursday, rejected an appeal by Takakito Usui, a transgender man who said forced sterilization violates the right to self-determination and is unconstitutional.

Usui, 45, appealed to the top court after he unsuccessfully requested that lower courts grant him legal recognition as male without having his female reproductive glands surgically removed.

Despite the unanimous decision, presiding justice Mamoru Miura joined another justice in saying that while the law may not violate the constitution, "doubts are undeniably emerging," according to Usui's lawyer, Tomoyasu Oyama.

The two judges proposed regular reviews of the law and appropriate measures "from the viewpoint of respect for personality and individuality," according to Japanese media reports.

Japan is one of many countries with a sterilization requirement. In 2017, the European Court of Human Rights said 22 of the countries under its jurisdiction still required sterilization as part of a legal gender change, and it ordered them to end the practice.

Maria Sjodin, deputy executive director of OutRight Action International, which monitors LGBT rights issues worldwide, said she was unsure if all 22 of those countries have fully implemented the court's order. She noted that Sweden, which did away with the requirement in 2013, later became the first country to pay damages to anyone forced to undergo sterilization as a requirement for gender change.

The Japanese Supreme Court decision ends Usui's legal battle, but he and his lawyer said the opinions in the ruling left them with hope.

"I think the ruling could lead to a next step," Usui told a news conference.

Human Rights Watch said the Supreme Court ruling was "incompatible with international human rights standards, goes against the times and deviates far from best global practices." The New York-based group said the ruling tolerates grave human rights violations against transgender people.

The ruling was also criticized by Japan's LGBT community.

A transgender activist and writer, Tomato Hatakeno, tweeted that the decision shows that society's interests still come before an individual's right to freedom regarding one's body.

"The ruling suggests that reproductive health is not recognized as a basic human right," she said.

There is a growing awareness of sexual diversity in Japan, but it is often superficial and generally limited to the entertainment industry. In a country where pressure for conformity is strong, many gay people hide their sexuality even from their families because of a fear of prejudice at home, school or work. Obstacles remain high for transgender people.

Japan does not legally recognize same-sex marriages. As LGBT rights awareness has gradually grown in recent years, some municipalities have begun issuing partnership certificates to ease problems in renting apartments and other areas, but they are not legally binding.

Lawmakers in the conservative ruling party have repeatedly come under fire for making discriminatory remarks about LGBT people. Earlier this year, Katsuei Hirasawa, a veteran lawmaker, was widely criticized for saying that "a nation would collapse" if everyone became LGBT. Last year, another ruling party lawmaker, Mio Sugita, was condemned after saying in a magazine that the government shouldn't use tax money for LGBT rights because same-sex couples aren't "productive."

Separately, more than a dozen people with disabilities have filed lawsuits against Japan's government for having been sterilized against their will under a 1948 Eugenics Protection Law that was in effect until 1996.

At least 16,500 people were sterilized without consent under the law, which allowed doctors to sterilize people with disabilities and was designed to "prevent the birth of poor-quality descendants." Some orphans were also sterilized.

The government has maintained the sterilizations were legal.

------

AP National Writer David Crary in New York contributed to this report.