A fall in the proportion of gay and bisexual men using condoms is behind the rise in HIV infections in those groups in the UK, say researchers.
Wider use of anti-retroviral drugs has helped to stop a sharper rise, a study by the Health Protection Agency (HPA) and a number of universities found.
They found a 26% rise, from 1990-2010, in the proportion of men who have sex with men who did not use condoms.
The report said the figures showed it was vital to promote safe sex.
Rates of HIV have been rising in recent years with latest figures showing cases among men who have sex with men (MSM) in the UK reaching an all-time high.
A recent report from the HPA found that nearly half of the 6,280 people diagnosed in the UK in 2011 were MSM.
Overall, one in 20 MSM are infected with HIV.
For this study, researchers analysed data from 1990 to 2010. They concluded that, without the introduction of anti-retroviral drugs to treat those with HIV, infections would be 68% higher in MSM.
Therapy with anti-retrovirals lowers the risk of people with HIV infecting others.
The report suggested the incidence of HIV could be 32% lower if all anti-retroviral treatment were prescribed from the moment of diagnosis rather than when health declined.
Further analysis showed that, if all MSM had stopped using condoms from 2000, rates of HIV in this group would now be 400% higher, the journal PLoS One reported.
The data also showed that the incidence of HIV could have dropped by a quarter if more HIV testing had been done.
But the researchers said the results showed that even a modest increase in unprotected sex was enough to erode the benefits of other interventions.
Study leader Professor Andrew Phillips, from University College London, said: "By better understanding the driving forces behind the trends we've seen in the past, it will allow us to make informed choices to reduce new HIV infections in the future."
Co-author Dr Valerie Delpech, who is head of HIV surveillance at the HPA, said: "Everyone should use a condom when having sex with new or casual partners, until all partners have had a sexual health screen.
"We also encourage men who have sex with men to get an HIV and STI screen at least annually, and every three months if having condomless sex with new or casual partners - and clinicians to take every opportunity to recommend HIV testing to this group."
Sir Nick Partridge, chief executive of the Terrence Higgins Trust, said condom use by gay men had played a key part in containing the spread of HIV in the UK.
"Without it, there would have been 80,000 more gay men with HIV between 2000 and 2010."
He added that the study showed the impact of the combined HIV strategy of promoting condoms, increasing regular HIV testing and encouraging the earlier use of anti-HIV drug therapy.
He added: "At a time when funding for local HIV prevention programmes is under threat, this only reinforces the important role which local authorities can and must play in funding local HIV prevention."