Rights advocates say they have recorded arrests in multiple Nigerian states, but the country’s north has experienced the toughest crackdown. Mr. Jonathan’s national ban has redoubled the zeal against gay people here and elsewhere, according to officials and residents in Bauchi, where Shariah law prevails and green-uniformed Hisbah, or Islamic police officers, search for what is considered immoral under Islam.

“It’s reawakened interest in communities to ‘sanitize,’ more or less, to talk about ‘moral sanitization,’ ” Dorothy Aken’Ova, executive director of Nigeria’s International Center for Reproductive Health and Sexual Rights, said of the law. “Where it was quiet before, it’s gotten people thinking, ‘Who is behaving in a manner that may be gay?’ It’s driven people into the closet.”

Officials here in Bauchi say they want to root out, imprison and punish gays. Local lawyers are reluctant to represent them. Bail was refused to the gay people already jailed because it was “in the best interests of the accused,” said the chief prosecutor, Dawood Mohammed. In the streets, furious citizens say they are ready to take the law into their own hands to combat homosexuality.

Officials are also inflamed. “It is detestable,” said Mohammed Tata, a senior official with the Shariah Commission here, which controls the Hisbah. He added: “This thing is an abomination.”

Complaining of the difficulty in distinguishing gay people from others, Mr. Tata said: “They don’t do it in the open. You get one or two, you see how they speak, you see how they dress, then you might have reasonable grounds to suspect.” Mr. Tata, speaking in the whitewashed two-story Shariah Commission headquarters here, said that happily, “we get information from sources interested in seeing the society cleansed.”