DAKAR, Senegal — In Senegal, never mind about same-sex marriage: gay men and lesbians are abused by the police, beaten and sometimes tortured, with impunity. They are threatened by mobs, mocked on the front pages of newspapers and subject to criminal prosecution for being gay. And the persecution is even more severe elsewhere in West Africa.

So it was hardly surprising that a day after President Obama, in front of hundreds of reporters, traded barbs with President Macky Sall of Senegal on the topic, people on the street, the press and the radio in Mr. Sall’s country lined up firmly on the same side.

During the opening leg of his visit to sub-Saharan Africa, Mr. Obama on Thursday called the Supreme Court’s decision the day before to strike down the Defense of Marriage Act a “victory for American democracy” and urged African nations that treat homosexuality as a crime, like Senegal, to make sure that the government does not discriminate against gays.

The comment prompted a retort from Mr. Sall that his country was not “homophobic.” Still, he added, “we are not ready to decriminalize homosexuality,” making a quick jab about the death penalty in the United States and earning plaudits from Senegal’s voluminous and voluble press.