A bill banning same sex marriages was passed by the Nigerian senate on Tuesday. Nigeria is Africa's most populous nation, and one of the few that hasn't bowed to western pressure to drop legislation that curbs gay rights.

The bill, which makes same-sex marriage punishable by a 14-year jail term, still has to be ratified by the country's lower house before being signed off by the president, Goodluck Jonathan. It also seeks to tighten existing legislation, which already outlaws gay sex, by criminalising anyone who witnesses or assists such marriages and making same-sex public displays of affection a jailable offence. Under the new law, groups that support gay rights would also be banned.During the debate in the capital, Abuja, one senator described homosexuality as a "mental illness" to cheers of approval. Another senator said that "such elements in society should be killed", prompting a fierce debate among Nigerian Twitter users. Many in Nigeria see the bill as a way for the government to score easy political points in a deeply religious society which is largely intolerant of homosexuality.

Only 1.4% of Nigerians felt "tolerant" towards sexual minorities, according to a 2008 survey by Nigeria's Information for Sexual and Reproductive Rights. Few dare to stand up for gay rights in the Muslim-majority north, where homosexual acts can incur sentences of death by stoning.

"I've never heard of a single Nigerian same-sex couple demanding to have marriage rights," said Unoma Azuah, a writer and gay rights activist. "So I am truly baffled as to why our lawmakers feel this debate is more relevant than terrorism, corruption, lack of infrastructure and education. The whole thing reminds me of the traditional Igbo proverb that says, 'He whose house is on fire does not go around chasing rats.'"

A Nigerian senator who spoke to the Guardian on condition of anonymity rebuffed the criticism, saying it was necessary to debate "big and small issues that matter for the country".

Much anti-gay rights sentiment is rooted in perceived suspicion that it is a foreign import being foisted on the country by interfering outsiders. While threats from western governments to cut off aid amid growing anti-gay sentiment in the continent has forced other African countries to scrap proposed anti-gay laws, it's had the opposite effect in Nigeria, whose treasury is awash with dollars from its 2m barrels-a-day oil industry. Nigerian rights activists have also largely shied away from attracting the attention of their international counterparts. "International gay rights groups have in some situations been a hindrance more than a help because they are not entirely aware of the kind of reality the Nigerian gay person lives under. Sometimes, by sensationalising the situation, they have invited the wrath of fundamentalist Christians who like to think of themselves as the "guardians of the African culture," said Unoma Azuah.

Among rights activists, it has become a grim joke that homophobia is a rare issue that unites the country's bickering Muslim north and Christian south. With governments often failing to provide basic services, the church is seen as a key social security net. "If you don't have the church, you really don't have anything else," said one gay Nigerian. He has refused to come out for fear of being forced to "repent" by his church congregation.

The new laws will have repercussions well beyond the gay community, said Damian Ugwu, an activist with the Lagos-based Social Justice Advocacy Initiative. Migrants who shared accommodation for economic reasons would be particularly vulnerable, he said. "From what I know of the Nigerian police, they look for every opportunity to extort money. With this bill, they won't go looking for gay couples in the Sheraton – they'll go just go around rounding up people who are poor or don't know their rights," he said.

In the north, policemen had visited hotels at night to seek out unmarried couples sleeping together. They demanded bribes or threatened to turn them in to the Islamic courts, Ugwu said.