Activist Kat Koles Kolenyane holds a LGBTQ pride flag inside the court before the ruling. [Photo: Courtesy]

Botswana’s High Court has decriminalised gay sex paving way for the legalisation of homosexuality in south African nation.

In a landmark ruling, the court declared section 164 of the penal code which criminalised same-sex relations unconstitutional. According to CNN, 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 decriminalization arguing that society had changed.

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