The penal system is also a primary reason that these diseases can’t be eliminated globally, and the problem goes well beyond condoms, according to Chris Beyrer, the Desmond Tutu Professor of Public Health and Human Rights at Hopkins, who edited the Lancet research series. He spoke with me by phone from South Africa, where he is co-chairing the International AIDS Conference in Durban. He sounded distraught over the fact that HIV infections stopped declining years ago in the United States, and are now stable around 45,000 every year.

In his findings, the spread of disease within prisons is a small factor compared to the effects of releasing inmates into the community with no access to treatment. Even in prison systems where people have antiviral medications, the primary problem is really the lack of care once they go back into the community. When a person with HIV, for example, has an interruption in their treatment regimen, the virus comes roaring back. Those people are infectious again, and often highly so. That creates a serious risk for their sexual partners, and anyone with whom they may share needles.

The scale of the problem is due to the fact that so many people are incarcerated in the first place, which Beyrer traces to the war on drugs.

“It’s abundantly clear that incarceration is a failure in terms of reducing substance abuse, but it also has these consequences for HIV, hepatitis, and TB,” he said. “We've been promoting this language around an ‘AIDS-free generation,’ but, in fact, failing ourselves.”

A practical approach to all of this is a new idea, but one that is supposed to be guaranteed by a recent international agreement. In 1955, the UN adopted a set of guidelines for the rights of prisoners, known as the Standard Minimum Rules for the Treatment of Prisoners. While they represented a major advance at the time, they were still minimal, lacking an understanding of how infections spread, and of substance abuse, and mental illness among prisoners, among myriad other roads that lead to prison and out of it.

It took 60 years for the world to espouse more comprehensive standards, but the General Assembly finally agreed on an update to the rules in December of 2015. Now known as the Mandela Rules—for the man who was effectively given tuberculosis as part of his sentence—they start from the basic premise that prisons must protect human rights and dignity. People need adequate food, sanitation, ventilation, and to be protected from violence.

Basic as that may sound, former UN Special Rapporteur on Torture Nigel Rodley called this a “real deontological reorientation of the philosophy of penal institutional management”—a move toward understanding prisons as places of preparation for reintegration into society. With that came a focus on health, which may be the most striking advance in the rules: They guarantee a full range of diagnostic, prevention, and treatment services, including mental health and drug-dependency treatment. They say that prisoners “should enjoy the same standards of health care that are available in the community, and should have access to necessary health-care services” and be organized in a way that ensures continuity of treatment and care after release.