Botswana's highest court has said the organization Lesbians, Gays and Bisexuals of Botswana (LEGABIBO) can be allowed to register. A five-judge bench at the Court of Appeals said the refusal had been unconstitutional.
Activists launched their legal battle after the Home Affairs Ministry rejected an application to register the gay rights lobby group.
But judges dismissed Home Affairs Minister Edwin Batshu's argument that registration might encourage the group's members to break the law.
"That concern or reason for refusal was irrational on the evidence before us, so there can be no question of his decision being necessary in the interests of public order," said Judge Ian Kirby, who handed down the ruling from a five-judge bench.
"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," he added.
The ruling means LEGABIBO will be able to register and campaign for changes in anti-gay legislation.
The judgment upheld a 2014 High Court ruling that declared that the 20 applicants were entitled to form a group. The attorney general, representing the government, then appealed the decision.
Engaging in homosexual acts remains illegal in Botswana, and rights campaigners said Wednesday's ruling was a challenge to an anti-gay agenda pursued by the government of President Ian Khama.
"There is a lot that still has to be done to ensure the promotion and protection of the human rights of the LGBT persons," said Cindy Kelemi, who works for local health advocacy group BONELA.