By Elias Biryabarema
ENTEBBE, Uganda, Feb 24 (Reuters) - Uganda's president signed a new law imposing harsh penalties on gay people on Monday, defying protests from rights groups, Western donors and a warning that it would complicate links with major ally Washington.
The new bill punishes anyone convicted of having gay sex with jail terms up to life, according to a draft of the legislation.
It also makes it a crime to fail to report someone for breaking the new law, again according to drafts.
Officials broke into loud applause as President Yoweri Museveni signed the bill into law in a ceremony in front of foreign journalists at his State House in the lakeside town of Entebbe outside the capital.
"There's now an attempt at social imperialism, to impose social values. We're sorry to see that you (the West) live the way you live but we keep quiet about it," he said.
Gay and lesbian organisations in Africa fear the ripple effect from the anti-gay bill could spread beyond Uganda to other parts of a continent where conservative societies tend to view homosexuality as unnatural.
"It's a gloomy day not just for the gay community in Uganda but for all Ugandans who care about human rights because this law will affect everybody," said Julian Peppe Onziema, a gay rights campaigner in Uganda.
Amnesty International said the law was "wildly discriminatory" and amounted to a grave assault on human rights.
The veteran leader's signature will please many voters opposed to homosexuality in the staunchly conservative east African country ahead of presidential elections in 2016, but risks alienating Western aid donors.
The law comes a week after U.S. President Barack Obama said the legislation would be "a step backward for all Ugandans" and warned it would complicate relations.
A senior Obama administration official had said the United States would review U.S. relations with Uganda if the law was enacted. Washington is one of Uganda's largest donors, sending more than $400 million a year in recent years.
While African leaders broadly court Western donors with promises to tackle human rights abuses, many have taken a hardline stance against homosexuality, describing it as "un-African" behaviour, often winning popular support.
"kudos to #Museveni for refusing to bow to #Obama demands on the homosexuality law," said Kenyan Twitter user @Chabbuh.
Another tweet by user @jkstephen78 read: "Bravo Museveni, it's an abomination in Africa." Other Twitter users criticised Museveni.
The anti-gay bill was introduced in 2009 and initially proposed a death sentence for homosexual acts. It was amended after an international outcry.
Days after Obama's statement, Museveni said he was putting the bill on hold to give scientists a chance to prove that homosexuality could be triggered by genes and was not a "lifestyle choice".
It was not immediately clear if he had received the go-ahead from any scientists before signing the bill on Monday.
Uganda is a key Western ally in the fight against Islamic extremism in Somalia where Ugandan troops have formed the backbone of the African Union peacekeeping force battling al Qaeda-aligned militants. (Writing by Drazen Jorgic; Editing by Richard Lough and Andrew Heavens)