Botswana's High Court has thrown out a decades-old law that criminalized same-sex relations in a landmark ruling lauded by activists. People who broke the law had faced the threat of a seven-year prison sentence.

The case was brought by a young activist who said Botswana's society had changed since the ban was enacted; on Tuesday, the court agreed.

"A democratic society is one that embraces tolerance, diversity and open-mindedness," Justice Michael Leburu said, according to CNN. Discussing the broad costs of discrimination, he added, "Societal inclusion is central to ending poverty and fostering shared prosperity."

The justices ruled that the law violated constitutional rights by denying dignity, liberty, privacy and equality to Botswana's lesbian, gay, bisexual and transgender citizens.

The Lesbians Gays and Bisexuals of Botswana — a group commonly known as LEGABIBO — celebrated victory in the case, in which it participated.

"It has taken a long time for our community to be where it is," said Anna Mmolai-Chalmers, the CEO of LEGABIBO. "This incredibly life-changing decision, althouth it does not right all the wrongs done to individual members of the LGBT community, is a step towards restoring our dignity as human beings."

As for what the ruling could mean for her community and for Botswana, Mmolai-Chalmers said that in addition to legal affirmation, the change will open new space "for addressing public health issues more efficiently and effectively."

Botswana joins a handful of other African nations that have recently decriminalized homosexuality — but Tuesday's ruling comes after a court in Kenya refused to take that step last month.

In both Botswana and Kenya, the ban on same-sex relations has its roots in British colonial law. Their bans share language, as they mention "carnal knowledge [of another person] against the order of nature."

The ruling comes 16 years after Botswana's Court of Appeal upheld the ban, saying the time had not yet come to decriminalize same-sex sexual behavior, even between consenting adults, and in private.

In addition to constitutional issues, the High Court's justices questioned the rationale behind the ban. According to a partial transcript released by LEGABIBO, the court wrote:

"What regulatory joy and solace is derived by the law, when it proscribes and criminalizes such conduct of two consenting adults, expressing and professing love to each other, within their secluded sphere, bedroom, confines and/or precinct?"

Calling it a case of over-regulation, the court concluded, "Any criminalization of love of finding fulfillment in love dilutes compassion and tolerance."

Copyright 2019 NPR. To see more, visit https://www.npr.org.