Uganda’s President Yoweri Museveni signed a bill criminalising homosexuality on Monday.
He said the law was needed to stop what he described as the West's “social imperialism” promoting homosexuality in Africa.
During the signing at his official residence, he cited a report by Ugandan scientists, which said there is no proven genetic basis for homosexuality, as his reason for backing the bill.
The signing was witnessed by government officials, journalists and the team of scientists.
He explained he had previously thought homosexuality was a genetic “abnormality”, but said he is now convinced that it is a choice made by individuals who may try to influence others.
The law, which builds on a colonial-era anti-homosexuality law, will see those found guilty of “homosexuality” sentenced to 14 years in jail.
Life imprisonment will be the maximum penalty for “aggravated homosexuality,” defined as repeated gay sex between consenting adults as well as same-sex acts involving a minor, a disabled person or where one partner is infected with HIV.
The original draft called for the death penalty for some homosexual acts, but this was removed from the legislation following an international outcry.
But the bill is popular in Uganda, where it has been championed by Christian clerics and many politicians.
Without naming them, Museveni accused “arrogant and careless Western groups” of trying to recruit Ugandan children into homosexuality.
“We Africans never seek to impose our view on others. If only they could let us alone,” he said, talking of Western pressure not to sign the bill.
“We have been disappointed for a long time by the conduct of the West. There is now an attempt at social imperialism.”
“Many of our homosexuals are mercenaries, heterosexuals who become homosexuals because of money. These are prostitutes for money,” he claimed.
Pepe Julian Onziema, a prominent Uganda gay activist, said he was disappointed that President Museveni signed the bill without speaking with Ugandan homosexuals.
“The president is making this decision because he has never met an openly gay person. That disappoints me,” he said, explaining that some members of Uganda's gay community had repeatedly tried and failed to meet with the President.
In the build-up to the signing, Sweden threatened to cut aid to Uganda if the measure was enacted, while US President Barack Obama warned that the bill would “complicate” the country’s relationship with Washington.
But President Museveni, whose popularity has been fading amid criticism that he wants to rule for life, had faced pressure from the ruling party to sign the anti-gay measure.
Some critics believe Museveni is signing the bill in hopes of galvanizing political support within his party, the National Resistance Movement, ahead of an upcoming meeting that is expected to endorse him as the party's sole choice in the next presidential election in 2016, when he will have been in power for 30 years.
Additional reporting by AP