Dr. Igoe said that a high proportion of the new cases involved migrants who had been infected before they came to the country, and people whose infection was detected through a local testing program introduced in 2016 that encourages people to discover their status early.

“It’s really a rare bright note in the treatment of H.I.V. that we can tell people, ‘If you take a test, find out your status early on, you can deal with it so that you don’t get sick, and you won’t make other people sick either,’” she said. “As we say, if the virus is undetectable, it’s untransmittable too.”

In recent years, government campaigns to reduce the harm from drugs, including the introduction of needle exchanges, methadone treatments and health education, have decreased the number of H.I.V. cases transmitted through drug use. In 2017, only 5 percent of the new H.I.V. diagnoses were found to have been transmitted via infected needles, while 53 percent were attributable to sex between men, according to health officials.

At the same time, the proportion of new cases via heterosexual transmission, once a small part of the total, has now risen to 33 percent. Dr. Igoe said many of these new cases involved migrants who were not aware of an infection and had come from countries with a much higher prevalence of heterosexual H.I.V. transmission, such as in sub-Saharan Africa.

Barriers to medicines may have also contributed to the increase. Andrew Leavitt, a spokesman for the Irish chapter of the international H.I.V. activist group Act Up, said the use of medications to prevent infection before and after exposure — so-called PrEP drugs that are particularly effective at reducing transmission among gay and bisexual men — has been hampered in Ireland by the slow introduction of cheaper generic versions of the drugs.