Updated at 11:50 a.m. ET on Thursday, June 27
(CNN) – Same-sex marriages should be recognized as valid even in states where the practice is forbidden, President Barack Obama said Thursday.
Speaking the day after an historic Supreme Court ruling striking down the key portion of the federal Defense of Marriage Act, Obama said the benefits of being married should extend to same-sex couples no matter where they live. Twelve states, plus the District of Columbia, currently allow same-sex marriage, while 35 states ban it.
"If you've been married in Massachusetts and move somewhere else, you're still married," Obama said in Dakar, Senegal, in a response to a question from CNN Chief White House Correspondent Jessica Yellin. "Under federal law, you should be able to obtain the benefits of any lawfully married couple. But again I'm speaking as a president not a lawyer."
Saying he's directed the federal government to ensure statutes that apply to married people are now properly extended to same-sex couples, Obama explained the Wednesday ruling did not mean that same-sex marriages were permitted nationwide.
"The Supreme Court did not make a blanket ruling that applies nationally, but rather lifted up the ability of states to recognize and respect same-sex marriage, and that the federal government couldn't negate the decision by those states," Obama said.
Obama's remarks came on the second day of a tour through Africa, a continent where many countries still outlaw homosexuality. In a meeting with Senegal's President Macky Sall, the country's ban on homosexuality did not come up, Obama said.
He did, however, say during a press conference that all nations must grant equal rights to all citizens, regardless of prevailing religious views.
"The issue of gays and lesbians and how they're treated has come up and is controversial in many parts of Africa," Obama said, noting that "when it comes to people's personal views and religion, faith, etcetera, I think we have to respect the religious views that are there."
"But when it comes to how the state treats people, how the law treats people, I believe that everybody has to be treated equally," Obama continued. "I don't believe in discrimination of any sort. That's my personal view. And I speak as somebody who comes from a country in which there were times when people were not treated equally under the law, and we had to fight long and hard under a civil rights struggle to make sure that happened."