The highest court in Botswana has ruled the government cannot ban a gay rights group.

In a rare victory for LGBT campaigners in a region that is socially conservative, the President of the Court of Appeal upheld a 2014 ruling that said Lesbian, Gays and Bisexuals of Botswana can register and campaign for legislative changes.

In his ruling, Judge Ian Kirby, said: “It is clear that the government’s decision [to seek the ban] interferes in the most fundamental way with the respondents’ right to form an association to protect and promote their interest.”

The decision of the court will comes as a blow to homophobic President Ian Kharma, who has pursued an anti-LGBT agenda and ensured that homosexual acts remain illegal.

In a country with some of the highest HIV infection rates on the continent, President Kharma has refused to distribute condoms in prison because it meant there would be more gay sex.

Homosexuality still remains illegal in many parts of Africa and punishable by death in some states.

Nigeria recently passed an anti-gay law this year and in August, Uganda called for countries that recognise same-sex marriage to be banned from adopting children from the nation.