He held off the virus for five more years, until pneumonia caught up with him as he raced to finish his third book, “Conduct Unbecoming,” a history of homosexuals in the American military. (His first was a biography of Harvey Milk, the gay San Francisco politician who was assassinated in 1978.) When Shilts died last week in his Guerneville, Calif., home at the age of 42 he became one of an estimated 50,000 Americans who will die this year in what doctors are now calling a “mature” epidemic – one that infects about as many new victims as it kills.

He kept his condition a secret as long as he could. “Every gay writer who tests positive ends up being an AIDS activist,” he once said. “I wanted to keep on being a reporter.” From his post at the San Francisco Chronicle, as the first full-time reporter on AIDS for a major American daily, he did as much as anyone to publicize the epidemic and what he viewed as the government’s cynical indifference to it. “By the time President Reagan had delivered his first speech on the epidemic. . .,” he wrote, “36,058 Americans had been diagnosed with the disease; 20,849 had died.” To straight Americans he brought the reassuring news that the only way to get AIDS from a mosquito was to have unprotected anal sex with one. To his own community, he had a more stringent message, that promiscuity and anonymous bathhouse sex were killing them. This ran counter both to the commercial interests of the bathhouse owners and to the broader issues of gay identity and liberation embodied in a remark attributed in Shilts’s book to San Francisco activist Konstantin Berlandt: “I didn’t become a homosexual so I could use condoms.” Shilts was called “a gay Uncle Tom,” booed and spat on in the streets of the Castro. “A lot of those people are still angry at Randy for wanting the bathhouses closed,” his friend Larry Kramer, the writer and AIDS activist, said last week. “But a lot of them are dead.”

Shilts acknowledged the special responsibility his homosexuality conferred on him. “Any good reporter could have done this story,” Shilts said in 1987, after “Band” was published. “But I think the reason I did it, and no one else did, is because I am gay. It was happening to people I care about and loved.” Combining passion with scrupulous journalism, Shilts leaves behind an invaluable chronicle of one of the great events of his time, and a dwindling band of friends who lived through the horrors of the 1980s with him. “We were the two grand old men of the AIDS activism movement,” said Kramer; “now that he’s gone I’m all alone and I feel naked and frightened.”