It has never been easy to be gay in Nigeria; persecution is rife and gay men and women are rarely open about their sexuality. But as of yesterday, being gay could be at the cost of your liberty. Nigeria’s president, Goodluck Jonathan, signed a bill into law that criminalises same-sex relationships. Containing penalties of up to 14 years in prison, it bans gay marriage, same-sex “amorous relationships”, and membership of gay rights groups. It was passed by the national assembly back in May, but Jonathan had delayed signing it into law.

It is not the first piece of legislation to target homosexuals: under Nigerian law, sodomy is already punishable with imprisonment. But it allows for a far broader crackdown on gay men and women than anything seen before. Since 2006, two similar bills have been proposed but have not made it through parliament. By criminalising gay rights groups, there is a concern that programmes like HIV/Aids treatment could be affected.

The bill has drawn criticism from western nations, including France,Britain, and the US. It comes soon after David Cameron made a statement suggesting that aid could be withdrawn from countries that persecute gay people. "This is something we raise continually,” he said last month. “We're also saying that British aid should have more strings attached in terms of 'do you persecute people for their faith or their Christianity or do you persecute people for their sexuality?’"

Cameron’s threat – which has been echoed by other western leaders – drew outrage from across Africa, with various leaders accusing the west of a colonial attitude. Zimbabwe’s Robert Mugabe went so far as to call Cameron “Satanic”. A Ugandan government spokesman condemned the "patronising, colonial rhetoric."

Of course, when it comes to Nigeria, which is mainly funded by its enormous oil output (2 million barrels per day), the threat of withdrawing aid is less significant than it is for a dependent nation like Uganda (which recently passed its own anti-gay bill).

The threat to withdraw aid raises questions about what western nations can or should do to influence policy in developing nations. Many African leaders feel that gay rights are opposed to their cultural and religious value systems, and that they should not be forced to accept western ideals. Nigeria is a profoundly religious society; its 170 million people are roughly half Muslim and half Christian (with many following regional religions). A Pew Research Centre survey last year found that Nigeria was the world’s least tolerant country on gay rights, with 98 per cent of respondents saying that society should not accept homosexuality. Defending the decision to sign the bill into law, the president’s spokesman Reuben Abatim said: “More than 90 per cent of Nigerians are opposed to same-sex marriage. So, the law is in line with our cultural and religious beliefs as people.”

But is popular support enough to justify legislative discrimination? Broadly speaking, in western nations, gay rights are seen as an indisputable part of broader human rights, with moves towards equalising marriage and criminalising discrimination. While it is a logical position to withhold aid that would support or enable a policy that runs counter to the donor nations’ sensibilities, there is a question mark over how far this can actually influence policy. Given the level of popular support for the repressive bill in Nigeria, it is likely to be a vote-winner for Jonathan. And even in Uganda – a nation that depends on aid money – the anti-gay bill passed in December (with life imprisonment, rather than the death penalty originally proposed) despite threats that contributions would be cut off. External action should take the form not only of vague threats of punitive measures but of continued support for persecuted individuals and work to educate and improve attitudes. At this stage, Nigeria’s gay community needs all the help they can get.