The number of gay and bisexual men contracting HIV rose over the past 20 years because of a rise in the number having unprotected sex, new research shows.

The number of UK men who have sex with men (MSM) having intercourse without a condom rose by 26% between 1990 and 2010, the study by the Health Protection Agency (HPA) and University College London (UCL) showed.

It comes weeks after a similar study warned that "unsafe sexual behaviour" and a lack of testing was behind a failure to cut the number of cases of HIV among gay and bisexual men in the last decade in England and Wales.

Speaking about the latest research, Dr Valerie Delpech, 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.

"Through combining earlier and more frequent HIV testing, programmes that reduce unsafe sexual behaviour and higher levels of antiretroviral (Art) coverage for those requiring it, we could substantially reduce HIV transmission in this group."

The latest research, published in the Plos One journal, also showed that the number of infections would have been 68% worse without the introduction of Art drugs in the same period, and 400% greater if condom use by gay and bisexual men had ceased entirely from 2000 onwards.

Last November, the HPA said that a record number of people in the UK were living with HIV, with the number of people with the virus reaching 96,000.

But health officials also warned that a quarter of people who have the human immunodeficiency virus are not aware they have been infected.

New diagnoses among gay men reached an all-time high in 2011, with 3,010 men discovering they were infected. The HPA said that one in 20 men who have sex with men in the UK now had HIV, with the figure soaring to nearly one in 12 in London.