While there, he struck up a friendship with Benedict Anderson, an eminent scholar of Indonesia and nationalism, who encouraged Mr. Oetomo’s academic interest in the diverse sexual customs of the Indonesian archipelago, and would later write the introduction to Mr. Oetomo’s first book on Indonesian sexuality, “Giving Voice to the Voiceless.”

At Cornell, Mr. Oetomo began publishing anonymous personal essays in Indonesian magazines where he expressed pride in his sexuality. He went on to found Lambda, Indonesia’s first gay rights organization, and after returning to Indonesia in 1984 began devoting much of his time to gay rights activism. “I got the idea from the U.S. that we should organize,” he said.

In 1987, Mr. Oetomo transformed Lambda into a new organization, Gaya Nusantara, which published a magazine that documented Indonesian ethnicities’ rich sexual diversity, such as the Bugis of Sulawesi, whose culture recognized five genders. Mr. Oetomo speaks excitedly of discovering annals showing that one of the most important kings of Majapahit, a major Javanese kingdom, sometimes wore women’s clothing to court. “I discovered that one myself,” he said. “We have a rich tradition!”

Through the years, the Indonesian government, uncomfortable with the subject and unwilling to grant rights to gay couples, grudgingly tolerated Mr. Oetomo’s activism. Every Sunday the house he shared with his partner in Surabaya, a large city in East Java, would turn into a community space, with workshops focused on H.I.V. prevention and other issues of concern.

In 1999, after Indonesia’s transition to democracy, Mr. Oetomo began the first of several runs for Parliament and other public office on the ticket of a small left-wing party. Not surprisingly, he lost each time. As Andreas Harsono, Indonesia researcher at Human Rights Watch and a longtime friend, said, “In Indonesia three things are considered political suicide: being Communist, being Chinese and being gay. Dede is at least two and a half of them.”

Still, the campaigns, as well as a later unsuccessful one to join Indonesia’s National Commission on Human Rights, established him as the country’s best-known advocate for gay rights. “He has this stubborn mentality,” Mr. Harsono said. “He’s always lost but never gives up.”

But now, with Islamist political parties pushing forward with a plan to criminalize same-sex relations, it often seems as though Mr. Oetomo’s life’s work in gay rights is about to be undone. This month Human Rights Watch released a report saying the rights of Indonesia’s sexual and gender minorities are under “unprecedented attack.”