* New law calls for life sentences in some cases
* United States says legislation will complicate ties
* Law will please conservative voters ahead of 2016 poll (Adds Austria reviewing aid, U.N. commissioner comment)
By Elias Biryabarema
ENTEBBE, Uganda, Feb 24 (Reuters) - Uganda's president signed a law imposing harsh penalties for homosexuality on Monday, defying protests from rights groups, criticism from Western donors and a U.S. warning that it will complicate relations.
The new bill strengthened existing punishments for anyone caught having gay sex, imposing jail terms of up to life for "aggravated homosexuality" - including sex with a minor or while HIV positive.
It criminalised lesbianism for the first time and made it a crime to help individuals engage in homosexual acts. Gay rights activists in Uganda said they planned a legal challenge.
Ugandan officials broke into loud applause as President Yoweri Museveni put his signature to the document in front of foreign journalists at his State House 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.
The legislation exposes the wide gulf between the continent's often culturally conservative administrations and many of the foreign donor states that support them. Gambia's President Yahya Jammeh last week called homosexuals "vermin".
"I feel sick. The degrading words the president has used ... my country is in a state of insanity right now," said Ugandan gay activist Kasha Nabagesera, adding the gay community expected to challenge the bill in the courts.
Gay and lesbian organisations fear the bill will encourage other governments to strengthen penalties, increase harassment, discourage people from taking HIV tests and make it impossible to live an openly gay life.
"Disapproval of homosexuality by some can never justify violating the fundamental human rights of others," U.N. High Commissioner for Human Rights Navi Pillay said in a statement.
Homosexuality is taboo in almost all African countries and illegal in 37 - including Uganda, where rights groups say gay people have long risked jail. Few Africans are openly gay, as they fear violence, imprisonment and loss of their jobs.
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.
Uganda is a key Western ally in the fight against Islamic extremism in Somalia, where Ugandan troops form the backbone of the African Union peacekeeping force battling al Qaeda-aligned militants.
A senior Obama administration official had said the United States would review relations with Uganda if the law was enacted. Washington is one of Uganda's largest donors, sending more than $400 million a year.
British Foreign Secretary William Hague said on Monday London questioned the bill's compatibility with the Ugandan constitution and international treaty obligations. But he made no mention of aid cuts from Britain, another big donor.
Austria said it would review aid. "The Foreign Ministry is carrying out a fundamental revision of development aid in general and human rights will play an important role in this," a spokesman said.
As well as being an ally of the West, Uganda expects to pump oil for the first time in 2016 and hopes the inflow of petrodollars will cut aid dependence.
"He knows that while the West cares about homosexuality, it's not to such an extent that they would severely punish a good ally," said Ugandan political analyst Angelo Izama.
A Ugandan government spokesman said Museveni had taken the unusual step of signing the bill in public to "demonstrate Uganda's independence in the face of Western pressure".
While African leaders broadly court Western donors with promises to tackle human rights abuses, many have won popular support by describing homosexuality as "un-African" behaviour.
The Uganda's move should please conservative voters ahead of presidential elections scheduled for 2016.
"We don't like (homosexuality) in our culture," said motor-bike taxi driver Ronald Kibabu. "That can keep him as president. The election is coming."
Museveni said last week 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". They found no such evidence, Museveni said.
In neighbouring Kenya, a group of MPs has called for the enforcement of existing anti-gay laws that have been largely ignored. Some Kenyans praised Uganda's actions.
"kudos to #Museveni for refusing to bow to #Obama demands on the homosexuality law," said Kenyan Twitter user @Chabbuh. (Additional reporting by Philippa Croome in Kampala and Georgina Prodhan in Vienna; Writing by Drazen Jorgic and Richard Lough; Editing by Edmund Blair and Andrew Roche)
Our Standards: The Thomson Reuters Trust Principles.