Uganda's president hassigned a controversial law allowing those convicted of homosexuality to be imprisoned for life, defying international disapproval from western donor nations.

At a public ceremony in a packed room at the State House in Entebbe, Yoweri Museveni formally initialled the anti-homosexuality act, which also outlaws the promotion of homosexuality and requires citizens to denounce to the police anyone suspected of being gay. "No study has shown you can be homosexual by nature. That's why I have agreed to sign the bill," Museveni said in a speech at the presidential palace near the capital, Kampala.

"Outsiders cannot dictate to us. This is our country. I advise friends from the west not to make this an issue, because if they make it an issue the more they will lose. If the west does not want to work with us because of homosexuals, then we have enough space to ourselves here."

Supporters clapped during the press conference. One MP sitting at a white table in the front row, said: "I hope the Obamas are receiving it live, Desmond Tutu, Cameron … [Museveni] has resisted them." The ethics and integrity minister, Simon Lokodo, said: "I feel very fulfilled, very elated, because at last my head of state has pronounced it on behalf of the entire nation, Uganda, that this is a bill that was worth putting in place."

David Bahati, the MP who introduced the bill, added: "This is a victory for the family of Uganda, a victory for the future of our children…"

The US announced on Monday night that it would begin an internal review of its relationship with Uganda's government, including assistance programmes. Barack Obama had warned Museveni that ties between Kampala and Washington would be damaged if the bill was passed.

The British foreign secretary, William Hague, said: "I am deeply saddened and disappointed that the anti-homosexuality bill in Uganda has been signed into law. The UK strongly opposes all discrimination on any grounds. "We question the [law's] compatibility with Uganda's constitution and international treaty obligations. There can be no doubt that [it] will increase persecution and discrimination of Ugandans, as well as damage Uganda's reputation internationally.We ask the government of Uganda to protect all its citizens and encourage tolerance, equality and respect."

Museveni, a key African ally of the US and the EU, had already come under fire from western donors for alleged corruption and had been under increasing pressure to block the legislation.

The anti-homosexuality bill passed through parliament in December after its architects agreed to drop a death penalty clause. The legislation requires those found guilty of repeat homosexuality to be jailed for life.

The South African Nobel peace laureate Desmond Tutu said at the weekend that the law recalled attempts by the Nazi and apartheid regimes to "legislate against love". Amnesty International called the bill a "horrific expansion of state-sanctioned homophobia".

Homophobia, supported by many US-funded evangelical Christians, has become more virulent in many parts of sub-Saharan Africa. In 2011, a prominent Ugandan gay rights campaigner, David Kato, was bludgeoned to death at his home after a newspaper splashed photos, names and addresses of gay people in Uganda on its front page along with a yellow banner reading "Hang Them".

This month Museveni, a devout evangelical Christian, also signed into law dress code legislation that outlaws "provocative" clothing, bans scantily-clad performers from appearing on Ugandan television and closely monitors what individuals view on the internet.

A coalition of UK gay rights groups and charities has written to the Foreign Office calling on Britain to withdraw its high commissioner in Kampala.

Jonathan Cooper, chief executive of the Human Dignity Trust and one of those who signed the letter, said: "[This] law promises to tyrannise the lives of the Ugandan lesbian, gay, bisexual and transgender communities. This is a huge blow for anyone who values basic human rights. This bleak situation will have an immediate effect on countries like the UK, the rest of the EU, Canada and US, as people flee and seek sanctuary."