The return of the long-lost son, as President Obama is widely seen by Kenyans, had all the elements of a family reunion. They hugged, they caught up, they talked about shared interests, they agreed they should get together more often, and they had their sibling spats.

In his first visit as president to his father’s home country, Mr. Obama struck a relentlessly upbeat tone, declaring, “Africa is on the move”; praising progress toward democracy and economic growth; and marveling over the changes he saw on the streets of this locked-down capital.

But he found himself at odds with his hosts on human rights and same-sex marriage and gingerly tried to nudge them to change their ways. At a news conference, he said the fight against terrorism in Kenya should not be used to justify a crackdown on dissent and argued that no nation should discriminate against gays and lesbians, comparing it to the era of segregation of African-Americans.

“If somebody is a law-abiding citizen who is going about their business and working in a job and obeying the traffic signs and doing all the other things good citizens are supposed to do and not harming anybody, the idea that they are going to be treated differently or abused because of who they love is wrong,” Mr. Obama said. “

Standing to his left on the lush lawn of the Kenyan State House, President Uhuru Kenyatta accepted the advice on human rights without argument, saying Kenya was trying to improve its handling of security and liberty. “This issue of terrorism is new to us,” he said, “and as it is new, we learn with each and every step.”

But in a country where homosexuality is widely condemned, he flatly rejected Mr. Obama’s views on gay rights. “There are some things we must admit we don’t share; our culture, our society don’t accept,” he said. “It is very difficult for us to be able to impose on people that which they themselves do not accept.”

The disagreement was quickly papered over, though, as both Mr. Obama and Kenyans focused on the historic nature of his visit. While Mr. Obama came here three times before taking office, many Kenyans had bristled that he waited until the seventh year of his presidency to return.

Obama joked that he had not wanted to make the rest of Africa jealous by coming too soon, but expressed a strong connection to Kenya. “I’m proud to be the first U.S. president to visit Kenya, and obviously, this is personal for me,” he said at a business forum. “There’s a reason why my name is Barack Hussein Obama. My father came from these parts and I have family and relatives here. And in my visits over the years, walking the streets of Nairobi, I’ve come to know the warmth and the spirit of the Kenyan people.”

He held out Kenya as a model in a fast-growing region. “Kenya is leading the way,” Mr. Obama said. “When I was here in Nairobi 10 years ago, it looked very different than it does today.”

He added, however, that the greatest threat to continued growth in Kenya is the scourge of corruption, found here from the local police officer to the highest politicians. Mr. Obama and Mr. Kenyatta released a 29-point plan for fighting corruption in Kenya. They also signed an “action plan” to bolster Kenya’s security in its fight against the Shabab, the Qaeda affiliate based in Somalia.

Mr. Obama had a long day of activities. He addressed the sixth annual Global Entrepreneurship Summit meeting, laid a wreath at a memorial to the victims of the 1998 bombing of the United States Embassy here and attended a state dinner in the evening, where he was serenaded in English and Swahili by a group that sang a song called “Coming Home.” In his toast, Mr. Obama joked that critics back home no doubt believed he had come “to look for my birth certificate,” adding, “That is not the case.”

The US Presidents’ visit in the country had all the hallmarks of a nation united, standing above tribal inclination and showing that Kenya is indeed a sleeping economic giant. There is a general feeling across the masses that Obama’s Kenyan tour will open up more opportunities to the country.

Across the streets in Nairobi the optimism on people faces and their upbeat tones was evident enough and majority of the people were unanimous on the thought that the country has great potential that needs to be harnessed and put to good use.

Obama ended his trip on Sunday evening and promised to come back with his family after he completes his term as American president.

By Yahya Gondosio