Botswana's government on Monday lost a legal attempt to overturn a landmark ruling that decriminalized homosexuality.
The country's High Court in 2019 ruled in favor of campaigners seeking to strike down jail sentences for same-sex relationships, declaring the punishment to be unconstitutional.
But the government sought to revoke the ruling, arguing that the courts had no jurisdiction in this matter.
"Since the appellant's grounds of appeal have been unsuccessful... the appeal must fall," Botswana's Court of Appeal ruled on Monday.
It had started hearing the case in October.
Homosexuality had been banned since 1965 in conservative Botswana, where offenders could face up to seven years in prison.
The 2019 judgment was hailed internationally as a major victory for gay rights.
Judge Ian Kirby, who read out the ruling on Monday, said gay citizens had long lived in "constant fear of discovery or arrest" when expressing "love for their partners."
"This sometimes led to depression, suicidal behavior, alcoholism or substance abuse," he said.
Botswana is one of only a handful of African countries to have decriminalized homosexuality.
Others are Lesotho, Mozambique, Angola and Seychelles.
South Africa is the sole nation on the continent to allow same-sex marriage, which it legalized in 2006.
Ugandans express support for the new controversial anti-LGBTQ+ law
LGBT activists disappointed at Uganda's new anti-gay law
Uganda's parliament passes tough anti-gay bill
Son of Namibian gay couple in citizenship limbo after court ruling
Go to video
Namibia: court cancels nationality of child of same-sex couple
Go to video
The US promises to “stand up” for LGBTQ+ rights in Kenya