ALBANY — There was a time when the diagnosis of H.I.V. was a death sentence, when thousands of New Yorkers, primarily gay men, succumbed to AIDS-related illnesses, and the end of the epidemic seemed both medically and mentally impossible.

On Wednesday, however, Gov. Andrew M. Cuomo declared that New York is on track to meet its goal to end the AIDS epidemic in the state by 2020.

After decades of fearsome infection rates, the state in 2018 had just 2,481 new diagnoses of the virus that causes AIDS, a drop of 11 percent from the previous year, and 28 percent less than 2014, when the state began its initiative.

The governor’s three-pronged plan to combat AIDS is centered around identifying, tracking and treating people with H.I.V. infection, including using pre-exposure prophylaxis, or PrEP, drugs that can drastically reduce the risk of contracting H.I.V. through unprotected sex.