Nigeria's President Goodluck Jonathan has approved a bill banning gay marriage and same-sex partnerships that sparked international condemnation, his spokesman said on Monday.
"I can confirm that the president has signed the bill into law," Goodluck Jonathan's spokesman Reuben Abati told AFP, without specifying a date but adding that it happened earlier this month.
Abati said Jonathan signed off on the Same Sex Marriage (Prohibition) Bill 2013 because it was consistent with the attitudes of most people towards homosexuality in the west African nation.
"More than 90 percent of Nigerians are opposed to same sex marriage. So, the law is in line with our cultural and religious beliefs as a people," he added.
"And I think that this law is made for a people and what (the) government has done is consistent with the preference of its environment."
Amnesty International urged Jonathan to reject the bill, calling it "discriminatory" and warning of "catastrophic" consequences for Nigeria's lesbian, gay, bisexual and transgender community.
Under the terms of the law, anyone who enters into a same-sex marriage or civil union can be sentenced to 14 years in prison while any such partnerships entered into abroad are deemed "void".
It also warns that anyone who registers, operates or participates in gay clubs, societies and organisations or who directly or indirectly makes a public show of a same-sex relationship will break the law.
Punishment is up to 10 years in prison, it adds.
"Only a marriage contract between a man and a woman shall be recognised as valid in Nigeria," the law states.
Nigeria is a highly religious society, with its 170 million people roughly divided in half between Christians and Muslims, though a significant number are also believed to follow traditional religions.
The anti-gay law follows similar legislation in Uganda that was condemned by US President Barack Obama as "odious" and compared to apartheid by South African peace icon Archbishop Desmond Tutu.