In a landmark judgement by Botswana's high court on Tuesday, Judge Michael Elburu ruled that a colonial-era law on homosexuality would be taken off the books.
Botswana would "set aside... the provisions of a Victorian era", said Elburu, and ordered the amendment of the 1965 penal code.
Cheers rang out in the courtroom after Eluru announced the verdict. Previously, anyone convicted of homosexuality would serve up to seven years in prison.
The High Court called penalizing people for who they are disrespectful, adding that laws should not govern what consenting adults do in private. The judges said that sexual orientation is part of the right to privacy.
The original petitioner against the law, who remains anonymous, was supported by LEGABIBO, a gay rights non-governmental organization.
"There are also many people of same-sex relationships in this country who have been violated and have also suffered in silence for fear of being discriminated. Just like other citizens, they deserve to have their rights protected," said LEGABIBO president Mokgweetsi Masisi before the ruling.
Human rights groups say that people in the LGBTQ community are discriminated against in all aspects of society, including basic services, such as health, employment, and education.
This news comes less than a month after Kenyan human rights activists were disappointed that the Kenya high court ruled to allow their colonial-era anti-homosexuality laws to remain on the books.
Earlier this year, Angola also ruled to decriminalize homosexuality.
However, more than two dozen countries in sub-Saharan Africa criminalize gay sex.