Nigeria's president has signed into law a bill that bans gay marriage, gay rights advocacy and public displays of affection between same-sex couples. Homosexual acts were already illegal in Nigeria. Human rights activists say the new law reflects a larger trend to ramp up anti-gay legislation and penalties.
Nigeria's new Same-Sex Marriage Prohibition Act has been condemned abroad but applauded at home.
And it has given President Goodluck Jonathan a much-needed popularity boost.
"I thought the Western world will so much pressurize us to bow to it, but hearing that the president signed against it, in fact it's a kudos. I'm very glad that he could stand [on] his feet and sign against such a taboo, because, I mean, it's un-African," said one citizen. "We don't want such a thing in our country."
Many African countries inherited their anti-sodomy laws from colonial rulers. Some have since added stiffer penalties and sought to broaden the list of offenses.
"It's a punitive trend that is not just about criminalizing same-sex conduct but is also about criminalizing the expression of ideas," said Neela Ghoshal, an Africa-based researcher for the LGBT division of Human Rights Watch
. "That is what we are seeing in Uganda and in Nigeria. The fact that governments feel they need to criminalize speech and organization and association is because there is a growing LGBTI [lesbian, gay, bisexual, transgender and intersex] movement in many African countries and governments find this threatening."
Activists said these laws violate international human rights conventions and, at times, the countries' own constitutions.
Uganda is waiting to see if its president will sign a new Anti-Homosexuality Bill passed by parliament in December. Under the bill, offenders could be imprisoned for life. The bill also includes jail time for just providing services to those who are lesbian, gay, bisexual or transgender.
Ugandan activists, like Pepe Onziema, said they will fight the law.
"It is not going to change us from being gay, it's not going to stop us from speaking out, it's not going to stop us from showing our faces," he said.
Harassment and attacks against gays in Africa have surged over the past decade.
Same-sex acts are illegal in 31 sub-Saharan countries. Actual enforcement varies widely and the punishment ranges from years in prison to the death penalty.
In South Africa, however, gay marriage and same-sex adoption are legal. And countries such as Mozambique and Botswana have outlawed forms of discrimination based on sexual orientation.
But gay men and woman say discrimination and danger persist throughout Africa. They can have trouble getting housing, jobs and even medical care and can face extortion and abuse from police.
Senegalese activist Seydou Djamil Ba said many hide their sexual orientation or try to go abroad. He says he doesn't push anyone to come out and it is a risk to live openly as a gay man in Senegal, in Africa. Any time your sexual orientation is known, he says, your life is in danger.
The push for tougher anti-gay legislation and policing in recent years has been accompanied by mob violence, the murders of activists, and street protests.
Defenders of anti-gay legislation in Africa said homosexuality is a threat to society and that the laws are about upholding religious and cultural values.
But analysts said politics play a role as well and the laws can reflect a scapegoating of the LGBT community.