Nigerian President Goodluck Jonathan had signed a law to make same-sex marriage illegal in his country.
(CNN) -- Nigerian President Goodluck Jonathan has signed into law a ban on same-sex marriage in Africa's most populous nation.
U.S. Secretary of State John Kerry slammed the decision Monday.
"Beyond even prohibiting same-sex marriage, this law dangerously restricts freedom of assembly, association and expression for all Nigerians," he said in a statement.
"People everywhere deserve to live in freedom and equality. No one should face violence or discrimination for who they are or who they love."
Samantha Power, U.S. ambassador to the United Nations, characterized the law as a "big setback for human rights for all Nigerians."
Uganda passes controversial anti-gay bill
Last month, Uganda's parliament passed controversial legislation that would make some gay acts punishable by life in prison.
For the bill to become law, it would need the signature of that county's president, who has 30 days to make a decision.
Homosexuality is illegal in most African nations based on remnants of sodomy laws introduced during the British colonial era and perpetuated by cultural beliefs.
Punishments across the continent range from fines to years in prison.
Worldwide, a growing number of countries now allow same-sex marriage, the majority of them in Europe.
The Netherlands was the first, in 2001, and it was later joined by Belgium, Spain, Norway, Sweden, Iceland, Portugal, Denmark and France. A bill to allow same-sex marriage in England and Wales is also now law, though it isn't expected to come into force until later this year.
French court rules mayors cannot block same-sex marriage
Argentina, Uruguay, Canada, Brazil, New Zealand and South Africa are the non-European countries in the group, according to the Pew Research Center.
Same-sex marriage is also legal in some parts of Mexico and the United States.
Source: CNN's Christian Purefoy and Faith Karimi contributed to this report.