"Experience shows that violence, conflict and terrorism feed on fear, mistrust and the despair born of poverty and frustration," he told the audience, which applauded him warmly. "Ultimately, the struggle against these enemies of peace must be carried on by men and women who fearlessly believe in, and bear honest witness to, the great spiritual and political values which inspired the birth of the nation."
Francis spoke generally about the threat posed by Al-Shabab and others, including the Islamic State in Iraq and the Levant (ISIL), which on Wednesday struck Tunisia within a fortnight of the Paris attacks.
"As we fight this war, recent events around the world have indeed taught us that we must do even more to bring unity and understanding between faiths, between ethnicities, between races but also between nations," he said.
Francis is aiming to bring a message of peace and reconciliation to Africa, but is also stressing other issues, including the need to fight poverty, protect the environment and encourage good governance.
Francis urged Kenya's political, social and economic leaders to work with "integrity and transparency" for the common good, a clear reference to Kenya's poor record on corruption. Transparency International ranked Kenya 145 out of 174 countries in its 2014 corruption perception index, and Kenyatta this week described corruption as a national security threat to East Africa's largest economy.
"I ask you in particular to show genuine concern for the needs of the poor, the aspirations of the young, and a just distribution of the natural and human resources with which the Creator has blessed your country," Francis said.
Kenyatta, for his part, said corruption was the major challenge facing the country. His rule has come under criticism for a lack of high-level prosecutions of officials accused of corruption.
On the eve of Francis' arrival, he replaced six ministers who vacated office after they were accused of corruption.
"Kenya's future depends on upholding the highest standards of integrity in governance, in inclusivity and in the protection of peace," Kenyatta said.
After visiting Nairobi's Kangemi slum Friday, Francis heads to Uganda where he'll pray at the shrine to the country's famous martyrs and celebrate a Mass.
Some uncomfortable issues may arise: The church's opposition to condoms as a way to fight AIDS, and its support of local legislation criminalizing homosexuality are chief among them.
But on the whole, the pope's visit is meant to tell the African church that it matters, said the Rev. Robert Dowd, professor of political science at the University of Notre Dame. "It has a crucial role to play in promoting justice and peace in societies where governments are not always accountable or responsive."
During his final stop on his trip, the pope will pay a visit to CAR, which will mark the first time a pope has flown into an active armed conflict.
The pope is due to arrive Sunday in Bangui. CAR has been highly volatile since early 2013, when Muslim rebels overthrew the president. Severe episodes of violence followed and has continued to flare despite the presence of more than 11,000 peacekeepers and police.
Francis is expected to encourage an interfaith peace initiative involving the archbishop, the evangelical leader and Bangui's imam.
"Your country has known for too long a situation of violence and insecurity where many of you have become innocent victims," he said in a video message sent to CAR Catholics ahead of his trip. "My aim is to bring you comfort, consolation and hope in the name of Jesus."
Wire services
Error
Sorry, your comment was not saved due to a technical problem. Please try again later or using a different browser.