President Barack Obama speaks during a news conference with Kenyan President Uhuru Kenyatta at the State House in Nairobi, Kenya, July 25, 2015.
President Barack Obama speaks during a news conference with Kenyan President Uhuru Kenyatta at the State House in Nairobi, Kenya, July 25, 2015.

NAIROBI - With the threat of al-Shabab looming, President Barack Obama said the United States and Kenya are united in the face of terrorism.

Speaking in Nairobi Saturday at a joint news conference with Kenyan President Uhuru Kenyatta, Obama said there has been extensive and effective counterterrorism coordination between the U.S. and Kenya, primarily in dealing with Somali militant group al-Shabab.

Obama praised the Kenyan people’s resolve in the wake of deadly al-Shabab attacks on Garissa and Nairobi’s Westgate Mall.

“We have systematically reduced the territory that al-Shabab controls, we have been able to decrease their effective control within Somalia and have weakened those networks operating here in East Africa. But that doesn’t mean the problem is solved," he said.

Kenyan President Uhuru Kenyatta, right, welcomes U
Kenyan President Uhuru Kenyatta, right, welcomes U.S. President Barack Obama to the State House in Nairobi, July 25, 2015. (Photo: Aru Pande / VOA)

During his talks with Kenyatta, Obama said he warned against unfairly targeting any one community or restricting freedoms in response to terrorism — saying such marginalization could fuel resentment and encourage extremism.

Human rights groups accuse Kenyan security forces of abuse and brutality during counterterrorism operations targeting Kenya’s Muslim and ethnic Somali population.

On the issue of human rights, Kenyatta acknowledged the country’s counterterror response was evolving.

“This is an existential fight for us. This is something that we have not been familiar with. Kenya has always been a country that has respected different religions. This issue of terrorism is new to us and as it is now, we learn with each and every step," he said.

Kenyatta said his government is instituting reforms and investing in underserved communities.

He also pledged to continue to root out corruption — an effort that drew praise and support from Obama.

The U.S. president also said both high- and low-level officials need to stop seeking bribes, which he said discourage people from starting new businesses.

WATCH: President Obama speaks at Nairobi's State House

?Gay rights

While the leaders pledged solidarity in fighting terrorism and corruption, they diverged sharply on the issue of gay rights.

Kenyatta said Kenya and the United States share many values, but the view on homosexuality is not one of them.

“For Kenyans today, the issue of gay rights is really a non-issue," he said, adding the country was focused on more pressing issues, such as terrorism.

His remarks were in stark contrast to those of Obama, who said: “I have been consistent all across Africa on this. I believe in the principle of treating people equally under the law and that they are deserving of equal protection under the law. And the state should not discriminate against people based on their sexual orientation.”

Obama acknowledged that while people may have different religious or cultural beliefs, the state should not treat people differently.

The U.S. president also thanked Kenya for taking in hundreds of thousands of refugees displaced by years of conflict in Somalia.

But Kenyatta said Kenya and the United States need to work much closer together to help stabilize Somalia, and help its government reduce the area controlled by al-Shabab, which has also carried out several deadly assaults in Kenya.

The two leaders addressed the press after holding talks at State House in Nairobi.

Crowds of Kenyans cheer and hold a painting repres
Crowds of Kenyans cheer and hold a painting representing US President Barack Obama near Memorial Park, in Nairobi on July 25, 2015.

In remarks before the meeting, Obama praised Kenya for moving away from ethnic tensions and toward "national unity."

He said the U.S. wants to work with African leaders and people "not out of charity" but out of common interests.

Earlier Saturday, Obama has said entrepreneurship in Africa helps break down barriers and build bridges between cultures, providing an alternative to violence and hopelessness.

In a speech to the Global Entrepreneurship Summit in Nairobi, Obama encouraged investment in African businesses and businesspeople. He said Africa needs to be a future hub of global growth, not just African growth.

"Africa is on the move," he said, adding, "Kenya is leading the way."

Nairobi's welcome

Obama is making his first visit to Kenya as U.S. president.

The streets of Nairobi have been painted and polished as the city has spared no expense to welcome Obama for what Kenyans have called his “homecoming.”  

Security is high for the visit of the U.S. president, with at least 10,000 police officers deployed in Nairobi. The U.S. Embassy has warned that the summit Obama is hosting could be "a target for terrorists."

A delegation of U.S. lawmakers and White House officials is accompanying Obama to the summit, a move the U.S. Embassy in Nairobi said underscores the importance the United States places on supporting Africa's entrepreneurs.

Kenyan President Uhuru Kenyatta, right, watches as
Kenyan President Uhuru Kenyatta, right, watches as President Barack Obama, center, hugs his half-sister Auma Obama, after he arrived at Kenyatta International Airport, on July 24, 2015, in Nairobi, Kenya.

Dinner with relatives

Obama's plane touched down in Nairobi Friday evening, with President Kenyatta greeting the U.S. president on the tarmac.

Obama, whose father was Kenyan, later had dinner with his Kenyan relatives, including his step-grandmother, Mama Sarah, and his half-sister Auma Obama.

U.S. officials said security concerns will prevent the president from traveling to the west Kenyan village of Kogelo where his father was born and is buried.

President Barack Obama raises a toast during a sta
President Barack Obama raises a toast during a state dinner hosted by Kenyan President Uhuru Kenyatta, left, at the State House in Nairobi, July 25, 2015.

Barack Obama Sr. was an economist who served in the government of Jomo Kenyatta, Kenya's first president and the father of the current president.

Obama last visited in 2006 as a U.S. senator.

But his first trip to Kenya as president, said Kenyan Deputy President William Ruto, means a lot to the country.

“President Obama is not just any other American president. He has African roots, and more specifically Kenyan roots, and so it is significant in a very different way,” Ruto told VOA.