Rafael, a muscular, affable 43-year-old, went to a clinic and within 45 minutes learned he was infected. Although it was already closing time, a counselor saw him immediately and offered him a doctor’s appointment the next day.

At Ward 86, the famous H.I.V. unit at San Francisco General Hospital, the doctor handed him pills for five days and a prescription for more. Because he was between jobs, she introduced him to a counselor who helped him file for public health insurance covering his $30,000-a-year treatment.

“They were very reassuring and very helpful,” said Rafael, who, like several other men interviewed for this article, spoke on condition that only his first name be used to protect his privacy. “They gave me the beautiful opportunity to just concentrate on my health.”