A long-acting drug injected every two months is more effective at preventing HIV than the pills most commonly used by people at risk of acquiring the infection, according to research released Tuesday at an international AIDS conference.

The drug cabotegravir was tested on more than 4,500 cisgender men who have sex with men and transgender women who have sex with men in 43 countries. While Truvada, the pill used most often to block the virus, is also highly effective, the injectable drug proved to be even better, the research shows.

Perhaps more importantly, an injection every two months may allow more people to remain on medication, known as "pre-exposure prophylaxis" or PrEP, that blocks the virus. People whose medical care is inconsistent, including homeless people, intravenous drug users and others in unstable situations, have trouble remaining on the daily pills. Others are reluctant to access them because of the stigma still associated with HIV.

"Giving individuals an option of an injection every eight weeks instead of taking a daily pill to prevent HIV provides choices and flexibility," Monica Gandhi, San Francisco co-chair of the AIDS 2020 conference, said in an e-mail. The worldwide conference is taking place online this week.

Truvada and Descovy, both manufactured by Gilead Sciences, are the only PrEP drugs approved by the Food and Drug Administration on the market. A generic form of Truvada is expected soon, but Gilead has been the target of activist groups for setting high prices for its drugs.

The injectable drug tested in the new study is made by ViiV Healthcare.

About 1.7 million people throughout the world became infected with HIV last year — a figure experts say could be greatly reduced if more people had access to PrEP and stayed on it. Taken daily, the drug is more than 90% effective at preventing sexual transmission of the virus and more than 70% effective at blocking it among people who inject street drugs and share needles.

But in the United States, only about 10% to 20% of the 1.1 million people considered at risk of contracting HIV are on PrEP. A disproportionate number of those not on medication are Black and Latino men who have sex with other men. The United States has launched a program that, in part, focuses on them in a bid to end transmission of HIV by 2030.