President Barack Obama has compared homophobia to racism, saying that both come from the same mindset.

Speaking to a Young African Leaders Initiative audience on Monday in Washington, D.C., Obama was asked by a participant from Kenya about reports of people with albinism being killed and their body parts harvested for rituals.

The president condemned the violence.

“The same, by the way, is true of sexual orientation,” Obama said. “I spoke about this in Africa, and everybody is like, 'Oh, oh, we don't want to hear that.' But the truth of the matter is, is that if you're treating people differently just because of who they love and who they are, then there's a connection between that mindset and the mindset that led to racism, and the mindset that leads to ethnic conflict. It means that you're not able to see somebody else as a human being.”

Obama's comments were well received, the Washington Blade reported.

(Related: In Kenya, Obama reiterates support for gay rights.)