The cause was adrenal cancer, said Gerard Koskovich, a friend and a spokesman for the Gay, Lesbian, Bisexual, Transgender Historical Society.

Mr. Sarria worked as a waiter and performed at the Black Cat Cafe, a gay bar in the North Beach section of San Francisco, in the 1950s and '60s. His campy satires of operas like "Carmen," performed in elaborate regalia and makeup, made him a recognizable face in the city's gay neighborhoods and a de facto community leader.

Laws against sodomy were in place throughout the United States at the time. In California, bars serving homosexuals could legally be raided and their patrons arrested.

Mr. Sarria (rhymes with Daria) helped found civic groups to fight discrimination against gay people. His frustration with the system led to his run for a seat on the Board of Supervisors, the legislative body for the city and county of San Francisco.

"I had a right to run for office," Mr. Sarria told The Atlantic in 2011. "I was angry, and I did it to prove a point."

He borrowed a suit for campaign photos and ran under the watchword "Equality!" He came in ninth out of a field of more than 30 candidates for five spots on the board and received more than 5,000 votes.

"From that day on," Mr. Sarria said, "there's never been a politician in San Francisco, not even a dogcatcher, that did not go and talk to the gay community."

José Julio Sarria was born on Dec. 12, 1922, in San Francisco. He enlisted in the Army during World War II and after the war stayed in Berlin, where he was active in theater. He returned to San Francisco in 1947 hoping to become a teacher but was arrested on morals charges that year in a public bathroom at the St. Francis Hotel. He was fined and, because of his arrest record, not permitted to teach, so he began working at the Black Cat.

Mr. Sarria helped found the League for Civil Education, a group dedicated to overturning laws that prohibited serving alcohol to gay people, in 1960; and the Society for Individual Rights, a broader gay advocacy and community group, in 1963. He worked at the Black Cat until it closed in 1963.

In 1965, Mr. Sarria proclaimed himself the first Empress of San Francisco and founded a gay rights organization called the Imperial Court de San Francisco (playing off a tradition of comically exaggerated royal titles among gay men). It became the International Court System, which now has 65 chapters (each of which elects its own empress and emperor) in the United States, Canada and Mexico.

No immediate family members survive.

Mr. Sarria did not run for office again. He was an ardent supporter and friend of Harvey Milk, who was elected supervisor in 1977, becoming the first openly gay elected official in California more than a decade and a half after Mr. Sarria's attempt. Mr. Milk and Mayor George Moscone were shot and killed on Nov. 27, 1978.