New HIV infections hit another record low in San Francisco last year as the city ramped up efforts to curtail transmission with aggressive prevention and treatment programs, according to a report released Friday.

Just 223 new infections were reported in 2016, down from 265 the previous year and representing a 90 percent drop from the peak of the AIDS epidemic in 1992. In the last four years alone, new cases of HIV have fallen nearly 50 percent.

The recent improvements come largely from a citywide campaign, called Getting to Zero, that focuses on dramatically slashing the number of new infections by 2020, with the ultimate goal of ending the epidemic altogether.

Public health officials said Friday they’re pleased with the results they’ve seen so far. But they noted that as overall numbers improve, it’s becoming increasingly clear that certain groups — black men and women, Latino men, transgender people, and people who are homeless — are still at heightened risk of contracting HIV and then suffering poor health outcomes because of it.

“We’ve got reduced new infections that we’re continuing to drive down. I’m optimistic,” said Dr. Susan Buchbinder, director of HIV research for the San Francisco Department of Public Health. “But now the epidemic is disproportionally affecting our most vulnerable populations. Just doing what we’ve been doing isn’t going to be enough.”

Rates of new infections — that means the number of cases per 100,000 people — fell or remained stable among all demographic groups except black women, for whom rates have climbed the past two years. Black and Latino men remain at highest risk of contracting HIV, with rates of 96 and 77 new infections per 100,000 people respectively, compared with 39 per 100,000 among white men.

Also concerning is that black and Latino men and women are all less likely than white men to receive care for HIV and to take medications that control the infection. In 2015, 84 percent of white people were receiving HIV care within a month of being diagnosed, compared with just 67 percent of black people. Within a year of diagnosis, 81 percent of white people were virally suppressed, meaning the amount of HIV in their blood was nearly undetectable; the virus in 69 percent of black people was suppressed.

Access to care and viral suppression data were especially problematic among homeless people. Of the 269 homeless people living with HIV in 2015, only a third were virally suppressed, according to the report.

Viral suppression is important for the health of the individual, but also for the community at large. When the amount of virus in the body is at undetectable levels, then the chance of transmitting HIV is almost nonexistent. So it’s critical to treat everyone who is already infected to prevent spreading it, public health officials say.

“San Francisco has always been committed to fighting. But these are folks we have yet to reach in our 30-plus years in this epidemic,” said Lance Toma, chief executive of the Asian and Pacific Islander Wellness Center, which provides treatment for people in the Tenderloin neighborhood and also works with homeless populations.

“It’s the folks who are most vulnerable who haven’t gotten the message yet,” Toma said. “We have to push into those communities. I feel like it’s achievable.”

Indeed, one program that targets homeless people shows that it’s possible to improve infection and suppression rates among the most at-risk populations, Toma said. The San Francisco program, called Linkage, Integration, Navigation and Comprehensive Services, tracks down people with HIV who are homeless and have fallen out of treatment, and links them to health care. Among people who participated in the program in 2015, 77 percent were virally suppressed.

One effect of putting more resources toward access to care is that even as new infections continue to fall, the number of people living with HIV is growing every year. That’s because people are surviving longer with the disease.

In 2016, just over 16,000 people were living with HIV in San Francisco — and nearly two-thirds of them were age 50 or older. Many of those older patients are people who became infected during the worst years of the epidemic in the 1980s and 1990s.

While it’s exciting that these long-term survivors are still here, it’s becoming apparent that they have mental health, housing and financial needs — in addition to primary health care issues — that are particular to their generation, public health and patient advocates say.

“There are a lot of specific issues faced by people with HIV as they age, and a lot of them are psychosocial. But they have to be addressed along with medical issues,” said Supervisor Jeff Sheehy, who co-founded the Getting to Zero campaign and who is a long-term HIV survivor himself. “We’re just getting started there.”

Sheehy added that he’s “cautiously optimistic” about the new HIV surveillance report and the city’s ability to keep pushing the number of new infections and other data toward ending the epidemic. But the hardest work remains ahead for San Francisco, he said.

“We want to be the first city to get to zero,” Sheehy said. “It’s going to be expensive and challenging, but you want to be the first. And we can do it.”

Erin Allday is a San Francisco Chronicle staff writer. Email: eallday@sfchronicle.com Twitter: @erinallday