Botswana on Tuesday decriminalized homosexuality in a landmark decision by the nation's High Court on Tuesday.

The High Court rejected sections of Botswana's penal code punishing gay sex with up to seven years in prison, deeming it unconstitutional.

TRUMP ADMINISTRATION PUSHES FOR END TO WORLDWIDE CRIMINALIZATION OF HOMOSEXUALITY

The ruling stated that penalizing people for who they are is both disrespectful and discriminatory, and said that the law shouldn't deal with private acts between consenting adults.

The judges of the High Court said sexual orientation is innate and not a "fashion statement," and cited a comment from President Mokgweetsi Masisi — which was shared by LEGABIBO, or Lesbians, Gays and Bisexuals of Botswana, ahead of the decision — in their ruling.

PENCE CONFIRMS TRUMP ADMINISTRATION DENIED US EMBASSY REQUEST TO FLY PRIDE FLAG

"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," Masisi said. "Just like other citizens, they deserve to have their rights protected."

In recent years, Botswana has taken other steps toward protecting LGBTQ rights. The High Court in 2017 ruled that the government should issue a transgender man documentation reflecting his identity, and in 2016 an appeals court ruled that LEGABIBO could register as a nonprofit.

Tuesday's ruling came less than a month after Kenya's High Court upheld similar sections of its own penal code in a unanimous ruling that disappointed the country's vibrant gay community. The laws prescribe up to 14 years in prison for people convicted of homosexual acts.

CLICK HERE TO GET THE FOX NEWS APP

More than two dozen countries in sub-Saharan Africa have laws criminalizing gay sex, often holdovers from colonial times. Earlier this year, the southern African nation of Angola decriminalized same-sex activity and banned discrimination based on sexual orientation.

The Associated Press contributed to this report.