GABORONE, Botswana – Botswana’s High Court has decriminalised gay sex, paving way for the legalisation of homosexuality in the country.

In a landmark ruling, the court declared section 164 of the penal code which criminalised same-sex relations unconstitutional.

The section which criminalised gay sex was defined as abhorring “carnal knowledge of any person against the order of nature,” and commanded a jail term of seven years.

Another one, section 167, which abhorred “acts of gross indecency” in private or public also commanded two-year jail term.

The case came after Letsweletse Motshidiemang, a 21-year-old student from University of Botswana, petitioned for the decriminalisation arguing that society had changed.

It came after Kenyan high court quashed similar petition upholding that same-sex relations remained illegal in the country.

More than two dozen countries in sub-Saharan Africa have laws criminalising gay sex.

Those arguing against the laws say they leave people in the LGBT community vulnerable to discrimination and abuse while making it difficult to access basic health and other services.

The Botswana-based non-governmental group LEGABIBO says such laws “infringe on basic human dignity.”

Early this year the southern African nation of Angola decriminalized same-sex activity and banned discrimination based on sexual orientation.