HIV infections in the United States are being detected months earlier than they used to be, according to the latest federal estimates, raising hopes among public health leaders in Minnesota as they try to prevent the spread of the sexually transmitted infection.

The U.S. Centers for Disease Control and Prevention (CDC) announced this week that people are discovering their HIV three years after infection, on average, which is seven months earlier than in 2011.

Shaving months off the time to detection is critical, state health officials said, because it reduces people’s chances of spreading the infection and hastens their access to the latest treatments, which can almost wipe out the virus.

“We have the tools to end HIV in Minnesota,” said Dr. Ed Ehlinger, state health commissioner.

Last month Minnesota became the third state to promote a concept known as U=U, which is based on research showing that drug treatment can reduce a patient’s virus load to the point that it is undetectable and therefore untransmittable.

State officials hope the concept will motivate people to seek regular testing and stick with treatment.

Earlier detection can also prevent HIV from developing into AIDS, which is diagnosed when the virus has reduced a patient’s white blood cell count to the point that it causes severe and sometimes irreversible immune damage.

Minnesota’s long-term HIV trends are generally positive. The number of new annual cases has dropped from more than 450 in 1991 to 290 last year. Fewer HIV cases are digressing to AIDS. And 2016 was the first year in decades with fewer than 100 related deaths.

However, there has been little change in the number of Minnesotans who already have AIDS when they first learn of their HIV infections — roughly 50 to 70 people each year. Some are foreign-born. Most are older, putting them outside the target demographic for the state’s HIV prevention campaigns.

The CDC reported a similar pattern: HIV detections among people 55 and older occurred 4.5 years after infection, compared to 2.5 years among people 24 and younger. Heterosexual males also were more likely to have delayed detection compared to women or men who have sex with other men.