DAKAR, Senegal — Laying bare a clash of cultures, President Obama urged African leaders Thursday to extend equal rights to gays and lesbians but was bluntly rebuked by Senegal’s president, who said his country ‘‘still isn’t ready’’ to decriminalize homosexuality.
Obama opened his weeklong trip to Africa one day after the US Supreme Court expanded federal benefits for married gay couples. In his first in-person comments on the ruling,
Obama said the court’s decision marked a ‘‘proud day for America.’’ He pressed for similar recognition for gay people in Africa, wading into a sensitive area in a region where dozens of countries outlaw homosexuality and a few punish violations with death.
‘‘When it comes to how the state treats people, how the law treats people, I believe that everybody has to be treated equally,’’ Obama said during a news conference with Senegalese President Macky Sall at the grand presidential palace in Dakar.
But Sall gave no ground. Senegal is ‘‘very tolerant,’’ he assured Obama, but is ‘‘still not ready to decriminalize homosexuality.’’
Sall said countries make decisions on complex issues in their own time, noting that Senegal has outlawed capital punishment while other countries have not — a pointed jab at the United States, where the death penalty is legal in many states.
Obama’s trip, which also includes stops in South Africa and Tanzania, marks the most extensive visit to Africa by the first black US president since he took office.
‘When it comes to how the state treats people . . . I believe that everybody has to be treated equally.’
Many Africans have expressed disappointment over Obama’s lack of direct engagement with affairs on their continent — particularly given that his father was Kenyan and he has many relatives living in Africa — yet he was still enthusiastically welcomed.
Thousands of people gathered on the roadways near the presidential palace as Obama’s motorcade sped through the coastal city, many in the crowds wearing white to symbolize peace. Some waved homemade signs welcoming Obama, while those gathered near the palace entrance sang and played drums, the rhythmic beats audible from inside the gates.
At Goree Island, the former slave trading post Obama visited later Thursday, local residents waited under scorching sun for hours to catch a glimpse of the president.
They sang a song about his return to his ancestral homeland and broke into jubilant cheers as the president and Michelle Obama walked over to shake hands.
Looming over the festive atmosphere were concerns over former South African leader Nelson Mandela. Obama is due to arrive in South Africa on Friday, though Mandela’s precarious condition adds some uncertainty to the agenda.
Obama spoke reverently about the impact that Mandela’s struggle against apartheid had on his own activism, as well as about the 94-year-old’s influence in Africa and around the world.
‘‘If and when he passes from this place, one thing I think we’ll all know is that his legacy is one that will linger on throughout the ages,’’ said Obama, who has sometimes been linked to Mandela given their shared status as their nations’ first black presidents.
Mandela’s democratic influence in Africa is at the core of Obama’s trip.
The three countries he will visit were selected as a signal of US support for African nations that have embraced democracy in a region where the legacy of corruption and authoritarianism has been hard to overcome.
Sall, for example, won the presidency in Senegal last year by ousting an incumbent president who attempted to change the constitution to make it easier for him to be reelected and for his son to succeed him.
Africa’s democratic movements have not been accompanied in most places by equal rights for gays and lesbians. A report Monday by Amnesty International said 38 African countries criminalize homosexuality.
In four of those — Mauritania, northern Nigeria, southern Somalia, and Sudan — the punishment is death.