The HIV epidemic can be brought under control by 2030 – providing everyone who needs treatment gets it – the United Nations’ HIV/AIDS agency says.

It has published a new report showing a global reduction in the number of new HIV infections and deaths from AIDS-related illnesses.

According to UNAIDS, 35 million people around the world are living with HIV.

There were 2.1 million new cases in 2013 – compared to 3.4 million figure in 2001 – a drop of 38%.

AIDS-related deaths have fallen by a fifth in the past three years, standing at 1.5 million a year. South Africa and Ethiopia have seen particular improvements.

But UNAIDS warns that key “obstacles” remain in the fight against the epidemic, particularly a lack of access to antiretroviral drugs.

In Nigeria, 80% of people do not have access to treatment.

Overall, fewer than four in 10 people with HIV are getting life-saving antiretroviral therapy.

The report said: “There have been more achievements in the past five years than in the preceding 23 years.

“There is evidence about what works and where the obstacles remain, more than ever before, there is hope that ending AIDS is possible.

“However, a business-as-usual approach or simply sustaining the AIDS response at its current pace cannot end the epidemic.”

UNAIDS Executive Director Michel Sidibe said: “If we accelerate all HIV scale-up by 2020, we will be on track to end the epidemic by 2030, if not, we risk significantly increasing the time it would take – adding a decade, if not more.”

The UN report revealed just 15 countries account for three-quarters of all new HIV infections .

In June, the Conservative peer and former UK Health Secretary Lord Fowler warned that the fight against HIV was “going backwards” in many parts of the world because of the strengthening of anti-gay legislation.

Earlier this year, the Ugandan Parliament passed a bill that will criminalise intentional transmission of HIV as well as attempted transmission of the virus.

Human Rights Watch described Uganda’s HIV law as “deeply flawed”.

Last Friday, the UN World Health Organisation announced that gay men should consider using antiretroviral drugs as an additional method of preventing HIV infection alongside the use of condoms.

The announcement generated a mixed response. Journalist Patrick McAleenan feared such a sweeping statement could stigmatise gay men and undermine condom use.

However, other health campaigners welcomed the WHO’s intervention, viewing it as a watershed moment in the debate on HIV prevention.