Botswana's court of appeal has upheld a ruling that foreign prisoners should receive free treatment for HIV/Aids, rights lawyers say.
Foreign prisoners were previously expected to pay for their own medication, unlike local inmates.
Two HIV-positive prisoners had challenged the government's refusal to pay for their anti-retrovirals (ARVs).
The UN estimates that about 25% of people aged between 15 and 49 are HIV-positive in Botswana.
A year ago the High Court ruled in favour of the two prisoners and the Botswana Network on Ethics, Law and HIV/Aids (Bonela), which backed their case.
But the state appealed against the decision.
According to the legal rights group Southern Africa Litigation Centre (SALC), the appeal court ordered that the treatment for foreign prisoners begin immediately and that free HIV testing also be offered.
"The judgment marks a decisive victory for public health in Botswana and the region. We look forward to the government taking immediate steps to roll out treatment to those prisoners falling within the treatment gap," Bonela's Phazha Molebatsi said in a statement.
Foreign prisoners made up more than 14% of Botswana's prison population in 2013, the International Centre for Prison Studies says.