Lawmakers in Burundi have passed, and its president has signed, a bill that makes being gay illegal in the African country.

President Pierre Nkurunziza secretly signed the legislation into law on April 22, despite widespread criticism from international human rights and gay rights groups.

The Senate had rejected the amendment when voting on a new draft criminal code law on February 17. In November, the lower chamber of Parliament had voted in favor of the amendment that prescribes two years in jail for being gay.

“Burundi has taken a disappointing step backward by legalizing discrimination,” said Scott Long, director of the Lesbian, Gay, Bisexual and Transgender Rights Program at Human Rights Watch, in a statement. “The government has fallen back on 'custom' and 'culture' to justify this repressive step – but there can be no justification for stripping some of Burundi's people of their fundamental rights.”

Nkurunziza's party, the CNDD-FDD, led several protests in favor of the legislation in March after the Senate had stripped the amendment.

At one such protest, 20,000 people took to the streets of Bujumbura, the county's capital, demanding assembly members reinstate the amendment.

Speaking to reporters at the event, CNDD-FDD Party Chairman Jeremie Ngendakumana said, “The CNDD-FDD is protesting today to support the [view of the] majority of Burundians that homosexuality should be punished by law.”

“Homosexuality is a sin. It is a culture which has been imported to sully our morals and is practiced by immoral people.”

“If we love our country, if we love our culture, we must ban this practice which will draw only misfortune for us,” he added.

The Assembly, which may overrule the Senate, decided to restore the amendment.

Human rights groups called the protests to reinstate the measure “staged” by the ruling Party. And claim the president himself leaned on lawmakers to pass the measure. Nkurunziza said in January that being gay was a “curse” on national television.

“We can't retreat, or it will seem like deputies are granting the right to have homosexual relations, even homosexual marriage, in Burundi,” said Jean Minani, a member of the Assembly.

Minani's view on the issue is one held by many in Africa, where anti-gay sentiment has been on the rise in recent years. Lawmakers in Nigeria are considering passing a draconian law that would criminalize gay unions under the guise of a gay marriage ban in a country where it is already illegal to be gay. Gay marriage bans generally only define marriage as a heterosexual union, denying gay couples the benefits and obligations of the institution, but the Nigerian law would go much further. The bill calls for three years of imprisonment for gay and lesbian couples caught living together and five years for anyone who witnesses or aids the pair.