President Obama, beginning a weeklong trip through Africa, said Thursday that gay marriages should be recognized across state lines, adding that all same-sex couples are entitled to federal benefits in the wake of the Supreme Court striking down the Defense of Marriage Act.

“It’s my personal belief — and I’m speaking now as a president as opposed to as a lawyer — if you’re married in Massachusetts and you move someplace else, you’re still married,” Obama said in a joint press conference with Senegal President Macky Sall. “Under federal law, you should be able to obtain the benefits of any lawfully married couple. But again, I’m speaking as a president and not a lawyer.”

The Obama administration is now looking at how to award federal benefits after Supreme Court justices overturned the 1996 law barring same-sex couples from receiving them. The president vowed to implement the new ruling as swiftly as possible, but questions remain about what the court decision means for gay partners who live in states where same-sex nuptials aren’t allowed.

Obama, whose Justice Department had already stopped enforcing the Defense of Marriage Act, called the Supreme Court’s ruling a “victory for American democracy.”

Obama made his call for gay rights, ironically, in an African nation where homosexuality is outlawed. The president said he did not discuss Senegal’s views on homosexuality with Sall. When questioned by an American reporter, Sall said his country was not homophobic but that it was not yet ready to decriminalize gay acts.

Addressing another major Supreme Court decision this week, Obama said justices “made a mistake” when they scrapped the centerpiece of the Voting Rights Act. He pledged to pursue new laws to protect voting rights in a “nonpartisan way.”