At a time of persecution for homosexuals in dozens of countries in Africa and around the world, the decision in Uganda was a brief respite: a presidential veto of a notorious bill that could imprison gays for life.
But the announcement on Friday was accompanied by such bizarre reasoning, along with further vows of repression of gays, that it was unlikely to reverse the disturbing trend that has stretched from Russia and India to Nigeria and Cameroon in recent months.
The Ugandan anti-gay bill, approved by its parliament last month, has become the most infamous of Africa's growing wave of official attacks on homosexuality because it originally called for gays to be subjected to the death penalty in some cases. Homosexuality is already criminalized in Uganda, but the new bill would make the penalties much harsher.
The death-penalty clause seems to have been dropped from the latest version of the Uganda bill, although the legal text has not been widely released and some activists suspect the clause is still included.
Uganda's media reported on Friday that President Yoweri Museveni had sent an eight-page letter to parliament, criticizing the anti-gay bill and saying that the parliamentary vote wasn't legally correct. But the President also unleashed a barrage of verbal attacks on gays, including some strange theories about the reasons for their sexual orientation.
Earlier this week, Nigeria announced that its president had signed a law to imprison gays for up to 14 years. The approval of the anti-gay law was accompanied by a wave of arrests of gays in several Nigerian states, and police were reportedly circulating lists of suspected gays who are under surveillance.
Last year, Russia passed a law to ban the distribution of homosexual "propaganda" to minors, effectively making it illegal to speak out for gay rights. On Friday, Russian President Vladimir Putin insisted that gays will be welcome at the upcoming Winter Olympics in Sochi as long as they "leave children in peace." In India, meanwhile, the Supreme Court in December struck down a court decision that would have overturned the criminalization of homosexuality.
This week, the newly approved Nigerian law has been widely condemned by leaders of the United Nations, Canada, the United States and others. Activists are worried that the Nigerian and Ugandan laws could hamper the fight against HIV and AIDS. But polls in Nigeria suggest the anti-gay law is supported by more than 90 per cent of the population.
Surveys in other African countries have found similarly huge majorities opposed to gays. Of the 54 countries in Africa, 36 have laws that criminalize homosexuality. Church leaders and politicians have often lobbied for anti-gay laws. The prejudices against homosexuality are rooted in influences from Western evangelists, Christian missionaries, British colonial laws and nationalistic interpretations of African traditional beliefs.
Western protests against the Ugandan anti-gay bill were undoubtedly a factor in Mr. Museveni's decision to oppose the law, since Uganda is heavily dependent on foreign aid. Among the many protests was a strong warning from British billionaire Richard Branson, who called for businesses to boycott Uganda.
Analysts warn that some African countries are supporting anti-gay laws as a way of standing up against what they see as unfair Western pressure and interference. Anti-gay laws have become an easy way for African leaders to portray themselves as patriotic and to distract attention from thornier issues of poverty and corruption.
In his lengthy letter to Uganda's parliament, reported on Friday by a Ugandan newspaper, Mr. Museveni denounced gays as "abnormal" and "disgusting" people who often practise homosexuality "for mercenary reasons." He was alluding to a popular Ugandan theory that young people are financially induced into homosexuality.
Some women, he claimed, become lesbians because of "sexual starvation" after they failed to marry. He added: "It could be that the Western societies, on account of random breeding, have generated many abnormal people."
Adopting a philosophical tone, he said: "The question at the core of the debate on homosexuality is: What do we do with an abnormal person? Do we kill him/her? Do we imprison him/her? Or do we contain him/her?"
According to a separate report quoting a Ugandan member of parliament, Mr. Museveni could still approve the anti-gay bill if the parliament agrees to "moderate" the bill by deleting some of its harsher provisions. One MP was quoted as saying that the bill is "unstoppable" and will be passed repeatedly by parliament until it becomes law. The President's veto can also be overturned by a two-thirds majority.
Homosexuals in Uganda, including foreigners, have often been physically attacked, threatened, harassed or arrested for their sexual orientation. One prominent gay-rights activist, David Kato, was killed in his home in 2011 after a Ugandan newspaper published the names, addresses and photos of a number of gays, along with a headline reading "Hang Them."