LONDON — President Yoweri Museveni of Uganda significantly strengthened Africa’s antigay movement on Monday, signing into law a bill imposing harsh sentences for homosexual acts, including life imprisonment in some cases, according to government officials.
The move came weeks after Mr. Museveni’s Nigerian counterpart, Goodluck Jonathan, took similar steps in his own country, threatening offenders with 14-year prison terms. The Uganda law seemed even tougher, calling for life terms for repeat convictions on the charge of “aggravated homosexuality” along with 14-year sentences for the “promotion or recognition” of homosexual relations.
Alluding to Western pressures to avoid signing the bill, Mr. Museveni said: “We Africans never seek to impose our view on others. If only they could let us alone,” The Associated Press reported.
He signed the bill at his official residence at Entebbe, near the capital, Kampala, in front of government officials, journalists and a team of Ugandan scientists who found no genetic basis for homosexuality — a conclusion that Mr. Museveni has cited in support of the new law, The A.P. said.
While Western gay-rights campaigners have accused American evangelical Christian groups of promoting antigay sentiment in Uganda, Mr. Museveni also accused “arrogant and careless Western groups” of seeking to draw Ugandan children into homosexuality.
The Ugandan government spokesman, Ofwono Opondo, said Mr. Museveni wanted to sign the bill “with the full witness of the international media to demonstrate Uganda’s independence in the face of Western pressure and provocation.” Mr. Opondo said in a message on Twitter that Mr. Museveni had signed the bill.
The Ugandan Parliament approved the law in December, saying it was aimed “at strengthening the nation’s capacity to deal with emerging internal and external threats to the traditional heterosexual family.”
Later that month, Mr. Museveni wrote a letter to Parliament saying that lawmakers had made procedural errors in passing the bill and that an in-depth study was needed before it could be taken up again. Mr. Museveni said at the time that he would seek further expert opinions.
But earlier this month, Mr. Museveni shifted position and said he would indeed sign the bill, apparently bowing to strong conservative opinion among Ugandans. Gay-rights activists in Uganda have vowed to oppose the legislation, which has drawn strong criticism from rights groups and outsiders including President Obama and could jeopardize hundreds of millions of dollars worth of crucial Western development aid.
According to Amnesty International, homosexuality is illegal in 38 of 54 African countries.
In Nigeria, Mr. Jonathan’s approval of the new law inspired mob violence against gays in areas including the capital, Abuja.
As the signing in Uganda approached on Monday, retired Archbishop Desmond M. Tutu of South Africa, a strong voice in the anti-apartheid struggle in South Africa, said in a statement: “We must be entirely clear about this: the history of people is littered with attempts to legislate against love or marriage across class, caste, and race. But there is no scientific basis or genetic rationale for love.”
Archbishop Tutu, who said he had been assured by Mr. Museveni that the bill would not be signed, declared: “There is no scientific justification for prejudice and discrimination, ever. And nor is there any moral justification. Nazi Germany and apartheid South Africa, among others, attest to these facts.”
The Ugandan law was first proposed in 2009, when an earlier provision — since dropped — proposed the death sentence for homosexual activity in some cases.
“President Museveni has dealt a dramatic blow to freedom of expression and association by signing the Anti-Homosexuality Bill,” said Maria E. Burnett, a senior researcher at Human Rights Watch. “Clawing back these basic rights and criminalizing the expression of divergent views doesn’t bode well for anyone in Uganda.”