GABORONE — Botswana's High Court will hear on Thursday a case challenging the criminalization of gay sex, offering campaigners a rare chance to argue for lesbian, gay, bisexual and transgender rights (LGBT) on a continent where homosexuality remains highly contentious.

Botswana's Penal Code outlaws "carnal knowledge of any person against the order of nature" and those convicted face jail sentences of up to seven years.

The case - filed in May 2018 by a gay man whose name has not been disclosed - will argue that the criminalization of same-sex sexual activity limits the ability of LGBT people to access basic social services, increases risks of discrimination and infringes on their basic human dignity.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

"Botswana is a diverse society and the constitution protects the freedoms and dignity of all persons in Botswana, regardless of whether you are gay, lesbian, bisexual, transgender or intersex," said Anna Mmolai-Chalmers, chief executive officer of Lesbians, Gays and Bisexuals of Botswana (LEGABIBO).

The LGBT community in Botswana is hopeful that gay sex will be decriminalized as the case comes after rulings in recent years which partially acknowledged the rights of LGBT people, including their right to equal protection before the law.

Botswana's President Mokgweetsi Masisi signaled his support for same-sex relations in a speech in December 2018, where he said LGBT citizens deserve to have their rights protected, but has not followed up his words with any new measures.

Same-sex relationships are illegal in more than 70 countries worldwide, almost half of them in Africa, where homosexuality is broadly taboo and persecution is rife.

In 2017, a transgender woman won a legal battle against Botswana's government to be recognized as female in a landmark victory for the rights of LGBT people.

Last month the Kenyan High Court postponed until May 24 a ruling on whether to strike down or uphold a colonial-era law banning gay sex.

FOLLOW NBC OUT ON TWITTER, FACEBOOK & INSTAGRAM