ABUJA Nigerian President Goodluck Jonathan signed a bill on Monday that criminalises same-sex relationships, defying Western pressure over gay rights and provoking criticism from the United States.
The bill, which contains penalties of up to 14 years in prison and bans gay marriage, same-sex "amorous relationships" and membership of gay rights groups, was passed by the national assembly last May but Jonathan had delayed signing it into law.
Presidency spokesman Reuben Abati told Reuters he had now done so.
As in much of sub-Saharan Africa, anti-gay sentiment and persecution of homosexuals is rife in Nigeria, so the new legislation is likely to be popular. Jonathan is expected to seek re-election in 2015 but is under pressure after several dozen lawmakers and a handful of regional governors defected to the opposition in the past two months.
Under existing Nigerian federal law, sodomy is punishable by jail, but this bill legislates for a much broader crackdown on homosexuals and lesbians, who already live a largely underground existence.
U.S. Secretary of State John Kerry said the United States was deeply concerned by the new measures.
"Beyond even prohibiting same sex marriage, this law dangerously restricts freedom of assembly ... and expression for all Nigerians," he said in a statement.
"It is inconsistent with Nigeria's international legal obligations and undermines ... democratic reforms and human rights protections."
While European countries, most recently France, have moved to offer same-sex couples the same legal rights enjoyed by heterosexuals, many African countries are seeking to tighten laws against homosexuality.
Britain and some other Western countries have threatened to cut aid to governments that pass laws persecuting homosexuals, a threat that has helped hold back or scupper such legislation in aid-dependent nations like Uganda and Malawi.
But they have little leverage over Nigeria, whose budget is funded by its 2-million-barrel-per-day oil output.
"Persons who enter into a same-sex marriage contract or civil union commit an offence and are each liable on conviction to a term of 14 years in prison," the bill says.
"Any person who registers, operates or participates in gay clubs, societies and organisations or directly or indirectly makes public show of same-sex amorous relationship in Nigeria commits an offence and shall each be liable on conviction to a term of 10 years in prison."
The news provoked an outpouring of anti-gay invective on Twitter, but there were also some who questioned the priorities of the president, who is commonly referred to by his initials.
"I cannot believe GEJ took time to sign a bill into law jailing people for being gay. I don't have any electricity, dude!" one post read.
(Writing by Joe Brock; Editing by Tim Cocks and Mark Trevelyan)
Our top photos from the last 24 hours.