Uganda’s President Yoweri Museveni has signed one of the world’s toughest anti-LGBTQ laws, including the death penalty for “aggravated homosexuality”, drawing Western condemnations and risking sanctions from aid donors.

Same-sex relations were already illegal in Uganda, as in more than 30 African countries, but the new law goes further.

It stipulates capital punishment for “serial offenders” against the law and transmission of a terminal illness like HIV/AIDS through gay sex. It also decrees a 20-year sentence for “promoting” homosexuality.

“The Ugandan president has today legalised state-sponsored homophobia and transphobia,” said Clare Byarugaba, a Ugandan rights activist.

A presidency photo showed Museveni signing the law with a golden pen at his desk. The 78-year-old has called homosexuality a “deviation from normal” and urged lawmakers to resist “imperialist” pressure.

A local organisation, Human Rights Awareness and Promotion Forum, and 10 other individuals later filed a complaint against the law at the constitutional court, one of the petitioners Busingye Kabumba told Reuters.

Museveni had sent the original bill passed in March back, asking parliament to tone down some provisions. But his ultimate approval was not seen as in doubt in a conservative country where anti-LGBTQ attitudes have hardened in recent years, in part due to campaigning by Western evangelical church groups.

Uganda receives billions of dollars in foreign aid each year and could now face adverse measures from donors and investors, as happened with a similar bill nine years ago.

REPRISALS?

The bill’s sponsor, Asuman Basalirwa, told reporters that parliament speaker Anita Among’s U.S. visa was cancelled after the law was signed. Among and the U.S. embassy in Uganda did not immediately respond to requests for comment.

In a joint statement, the U.S.’s flagship HIV/AIDS programme PEPFAR, the Global Fund to Fight AIDS, Tuberculosis and Malaria, and the Joint United Nations Programme on HIV/AIDS (UNAIDS) said the law put Uganda’s anti-HIV fight “in grave jeopardy”.

Dominic Arnall, chief executive of Open For Business, a coalition of companies that includes Google GOOGL.O and Microsoft MSFT.O, said the group was deeply disappointed and the law ran counter to Ugandans’ economic interests.

The U.N. human rights body declared itself “appalled”.

Uganda’s move could encourage lawmakers in neighbouring Kenya and Tanzania seeking similar measures.

“What a leader we’ve in Africa!” tweeted George Kaluma, a Kenyan member of parliament who submitted an anti-LGBTQ bill in April.

“Kenya is following you in this endeavour to save humanity.”

The inclusion of the death penalty for offences like transmitting HIV has drawn particular outrage internationally.

Existing Ugandan law calls for a maximum 10-year sentence for intentionally transmitting HIV and does not apply when the person who contracted the infection was aware of their sexual partner’s HIV status.

By contrast, the new law makes no distinction between intentional and unintentional transmission and contains no exception based on awareness of HIV status.

The amended version of the bill, adopted earlier this month after Museveni returned it to parliament, stipulated that merely identifying as LGBTQ is not a crime and revised a measure that obliged people to report homosexual activity to only require reporting when a child is involved.

‘LIKE APARTHEID’

LGBTQ Ugandans called those changes useless, saying law enforcement regularly exceeds its legal authorities to harass them. They said passage of the bill in March unleashed a wave of arrests, evictions and mob attacks.

The issue has been a long-running one in Uganda.

A less restrictive 2014 anti-LGBTQ law was struck down by a Ugandan court on procedural grounds, after Western governments had initially suspended some aid, imposed visa restrictions and curtailed security cooperation.

In 2009, a bill dubbed “kill the gays” for initially proposing executing homosexuals was introduced after a conference in Kampala drew representatives from the United States including prominent anti-gay evangelical Scott Lively.

As well as religious campaigning, Africa’s anti-LGBTQ attitudes also have their roots in the colonial era, including an anti-sodomy section of Britain’s penal code. By the time the UK legalised same-sex acts in 1967, many former colonies were independent and did not inherit the legal change.

“To reduce any kind of human being, irrespective of their sexuality, to a death sentence based on who they identify as and how they choose to live their lives is something that we should all feel very ashamed about as a continent,” said South African filmmaker Lerato.

“We can liken this to apartheid if not worse.”