Scrapping laws that ban sex work would slash the number of HIV infections over the next decade, according to a study presented at the world AIDS forum on Tuesday.
Female sex work is one of the big vectors of the world HIV pandemic, sometimes being the bridge between infected drug users and heterosexual men who buy sex from them.
But policymakers have squabbled about how best to deal with the question.
They have wrestled with initiatives such as outreach programmes to promote condom use and widen access to HIV drugs, changing policing practices or making laws softer or harsher.
Yet there is little agreement about which policies work best in reducing the HIV risk, both for sex workers and their clients.
Seeking an answer, researchers reporting at the 20th International AIDS Conference said they made a mathematical model based on grassroots data from a range of countries.
Legalisation best option
Of all the main policy options, decriminalisation was by far the most effective, they found.
By practising their trade legally, female sex workers were likelier to get advice about safe sex, use condoms and gain access to drugs that suppress the AIDS virus.
They also became less exposed to sexual violence from police and more able to refuse demands for unprotected sex from customers -- both of which are risks for spreading the human immunodeficiency virus (HIV).
"Decriminalisation of sex work would have the greatest effect on the course of HIV epidemics across all settings, averting 33-46 percent of HIV infections in the next decade," according to the study, which also appeared in an online issue published by The Lancet.
Other methods could be useful, too, depending on the location.
In Kenya, for instance, if badly-infected sex workers were given access to virus-suppressing drugs, this would help to reduce new cases of HIV by more than a third over the next decade.
The researchers, led by Kate Shannon of the University of British Columbia in Vancouver, Canada, acknowledged they had blanks in their database.
To build their model, they trawled through 204 studies in peer-reviewed journals, only 87 of which had useful data.
Most of these published investigations were conducted in Asia. Very few took place in sub-Saharan Africa, Russia and eastern Europe, where HIV transmission through sex work is a huge problem.
A 2012 investigation in 50 low- and middle-income countries found that nearly 12 percent of sex workers there had HIV.
They were more than 13 times likelier to have the AIDS virus than counterparts in the general population.
Countries where more than 50 percent of sex workers have HIV are all south of the Sahara, and 92 percent of all AIDS-related deaths attributed to sex work occur among African women, according to new research.
Separately, a commentary carried by The Lancet poured cold water on the so-called Swedish model for sex workers, which is gaining favour in parts of Europe.
In Sweden sex workers are not criminalised, but those who buy services from them or who profit from them -- customers and pimps -- are.
Supporters say the policy discourages trafficking.
But such claims are "unsubstantiated," the commentary said.
"Anti-trafficking advocates contend that criminalisation drives the sex industry even more underground, which results in significantly lower chances of identifying individuals who have been trafficked."