NAIROBI, Kenya (RNS) Religious leaders in Africa strongly rebuked President Obama’s call to decriminalize homosexuality, suggesting it's the reason why he received a less-than-warm welcome during a recent trip to the continent.

In a news conference in Senegal during his three-nation tour, just as the U.S. Supreme Court struck down a federal ban on same-sex marriage, Obama said African nations must grant equal protection to all people regardless of their sexual orientation.

"My basic view is that regardless of race, regardless of religion, regardless of gender, regardless of sexual orientation, when it comes to how the law treats you, how the state treats you ... people should be treated equally," Obama said. "And that’s a principle that I think applies universally."

But Obama’s words rubbed religious and political leaders the wrong way. In Senegal, the West African nation where Islam is the predominant religion, homosexuality is a crime.

Christianity and Islam are growing fast on the continent, and religious leaders in both faith communities responded with vehement denunciations.

Indeed, some clerics said Obama’s statements on gays spoiled the welcome religious leaders and their followers could have accorded the first African-American president.

“For religious leaders, in my point of view, this issue of homosexuality which he mentioned had really blocked the hospitality which the religious leaders desired to reserve for him,” said the Rev. Pierre Adama Faye, a Senegalese Lutheran leader.

Faye said he understood Obama’s remarks coming on the heels of the Supreme Court rulings. But he said Africa has its own reality, different from that of the U.S. In Senegal, churches and mosques reject the practice.

Homosexuality is illegal in 37 African countries, according to the Washington-based Council for Global Equality, and many religious leaders here view it as contrary to scriptures and custom.

Sheikh Saliou Mbacke, a Senegalese Muslim leader who coordinates the Interfaith Action for Peace in Africa, said faith leaders have the duty to speak out, especially if outside forces want to impose their will.

“The subject of homosexuality must not be used as a tool to blackmail and coerce society to defy God's command, which is more important than any world power,” he said. “We will oppose any manner of arm-twisting that threatens us to embrace it in our societies.”

In Nairobi, Roman Catholic Cardinal John Njue voiced similar concerns, and said Africans must be allowed to forge their own consensus on the subject.

“I think we need to act according to our own traditions and even our own faiths,” he said. “This is very important. We have to be proud of who we are.”

In Tanzania, Anglican Bishop Michael Hafidh of Dar es Salaam said religious leaders followed Obama’s tour closely and would have preferred for Obama to stick to trade and economic issues.

Homosexuality, said Hafidh, “is not an important issue for us now. We don’t recognize or even think of it, let alone its legalization. I think since we have a lot of resources, our discussions with the rest of the world should be more about investments and trade."

The Rev.Victor Ndlovu, a Roman Catholic priest in Johannesburg, South Africa, where gay marriage is legal, said homosexuality has become a human rights issue in the West and many religious leaders are anxious about how that might affect their congregations.

“They are worried what will become of the past in which the practice has been a taboo,” he said. “In reality, it exists in Africa, but the question is what we do when a man has said he wants to marry a man. It is a delicate balance.”

According to Ndlovu, Africa needs to open discussions on the subject since there is a danger that homosexuality may become an accepted lifestyle choice if leaders let down their guard.

“Obama has raised it now, but we should find ways of dealing with it in our own settings," Ndlovu said. "We cannot close ourselves and ignore it. It will soon explode if we don’t deal with it.”