People walk under a giant rainbow flag at the Gay Pride Parade in the Ugandan city of Entebbe in 2015
People walk under a giant rainbow flag at the Gay Pride Parade in the Ugandan city of Entebbe in 2015 AFP

Ugandan activists called on foreign donors to impose sanctions on rights abusers after President Yoweri Museveni signed an anti-gay law described as among the world's harshest.

The veteran leader defied warnings that approving the much-criticised bill against homosexuality would strain ties between Kampala and key international partners and aid donors, including Washington.

Among other harsh measures, the new law prescribes a death penalty for "aggravated homosexuality" in certain circumstances, although Uganda has not carried out capital punishment for many years.

The move has trigged outcry and calls for a tough response from Uganda's diplomatic and financial backers.

"This is a key time for stakeholders, such as the US and the EU, to move forward with sanctions against Ugandans implicated in human rights abuses," a coalition of Ugandan activist groups said in a statement late Monday.

They warned that the "dangerous and discriminatory" law would further shrink space for civil society under Museveni, whose rule has become increasingly authoritarian since he took power in 1986.

"Creating new crimes like these are a well-know way to engineer a legal basis to throw those with divergent views behind bars," said Clare Byarugaba from Chapter Four Uganda, one of the groups calling for sanctions.

She said the law would also discourage members of the LQBTQ community from seeking treatment for HIV and would "devastate the fight" against the disease in Uganda.

Ugandan lawmakers have stood firm against western criticism over the bill since it was first introduced to parliament in March, even if it meant cuts to foreign aid or other repercussions.

US President Joe Biden on Monday said it was "a tragic violation of universal human rights" and threatened to cut aid and investment if the bill was not repealed.

Biden said he had asked his National Security Council to assess what the law means for "all aspects of US engagement with Uganda", including services providing AIDS relief and other assistance and investments.

He said the administration would also consider sanctions against Uganda and the restriction of entry into the United States for people engaging in human rights abuses or corruption there.

EU foreign policy chief Josep Borrell said the Ugandan government was obligated to uphold the rights of all its citizens and "failure to do so will undermine relationships with international partners".

In 2014, donors slashed aid to Uganda after Museveni approved a bill that sought to impose life imprisonment for homosexual relations, but was later overturned.

The Netherlands froze a seven-million-euro subsidy to Uganda's legal system, while Denmark and Norway redirected around six million euros each towards private sector initiatives, aid agencies and rights organisations.

The US -- under President Barrack Obama -- also cut aid and trading rights.

Though criticised abroad, the latest anti-gay bill has enjoyed broad support in the conservative country, where lawmakers defended the measures as a necessary bulwark against Western immorality.

Homosexuality was criminalised in Uganda under colonial laws, but there has never been a conviction for consensual same-sex activity since independence from Britain in 1962.