President Obama openly criticized Kenyan laws that criminalize sexual activity between men Saturday and lectured Kenyan President Uhuru Kenyatta on the country's gay rights record. Kenyatta hit back at Obama's assertion, calling the issue of gay rights "really a non-issue" for Kenyans and that Kenyan "culture, our societies don't accept."

"I believe in the principle of treating people equally under the law, and that they are deserving of equal protection under the law and that the state should not discriminate against people based on their sexual orientation," Obama said at a joint press conference in Nairobi. "And I say that, recognizing that there may be people who have different religious or cultural beliefs. But the issue is how does the state operate relative to people."

"When you start treating people differently not because of any harm they are doing to anybody, but because they are different, that's the path whereby freedoms begin to erode," Obama said at a joint press conference with the Kenyan leader in Nairobi. "And bad things happen."

Obama compared Kenya's laws, which punish homosexual activity with a maximum of 14 years imprisonment, with racism in America.

"When a government gets in a habit of people treating people differently, those habits can spread," Obama continued. "As an African-American, I am painfully aware of what happens when people are treated differently under the law."

Kenyan leaders had asked Obama to not bring up the issue ahead of the trip, according to reports.

The Kenyan president, standing alongside Obama at a separate podium, wasn't shy about disagreeing with him on the issue.

"The fact of the matter is Kenya and the U.S. share so many values: common love for democracy, entrepreneurship, value for families — these are some things that we share," Kenyatta said. "But there are some things that we must admit we don't share, our culture, our societies don't accept."

"It is very difficult for us to be able to impose on people that which they themselves do not accept," said Kenyatta. "This is why I repeatedly say that for Kenyans today the issue of gay rights is really a non-issue. We want to focus on other areas that are day to day living for our people. But as of now the fact remains that this issue is not really an issue that is on the foremost mind of most Kenyans."

Kenyatta received applause for his comments.

Obama's father was born in Kenya and he is a popular figure in the country, despite his disagreement with the majority of Kenyans on this issue. Obama's last visit to Kenya took place in 2006 when he was a U.S. senator.