HAVANA — President Obama spoke of his Kenyan heritage. He talked about how both the United States and Cuba were built on the backs of slaves from Africa. He mentioned that not very long ago, his parents’ marriage would have been illegal in America, and he urged Cubans to respect the power of protest to bring about equality.

“We want our engagement to help lift up Cubans who are of African descent,” he said, “who have proven there’s nothing they cannot achieve when given the chance.”

Mr. Obama’s speech on Tuesday, in an ornate Spanish colonial-style hall in Havana, was not only strikingly personal. It was also an unusually direct engagement with race, a critical and unresolved issue in Cuban society that the revolution was supposed to have erased.

For many Cubans, Mr. Obama’s comments were striking for their acknowledgment of racism in both countries. They served as a reminder that their particular kinship with him — as reflected in dozens of conversations and responses to his history-making three-day visit this week — involves not just policy, but also identity.