Pope Francis said on Thursday in Kenya, which has seen a spate of attacks by Islamist militants, that dialoguebetween religions in Africa was essential to teach young people that violence in God's name was unjustified.
Bridging divisions between Muslims and Christians is a main theme of his first tour of the continent that also takes him to Uganda, which like Kenya has seen a number of Islamist attacks, and the Central African Republic, riven by sectarian conflict.
Starting his first full day in the Kenyan capital, Francis met Muslim and other religious leaders before saying an open-air Mass for tens of thousands of rain-drenched people who sang, danced and ululated as he arrived in an open popemobile.
"All too often, young people are being radicalised in the name of religion to sow discord and fear, and to tear at the very fabric of our societies," he told about 25 religious leaders.
Inter-religious dialogue "is not a luxury. It is not something extra or optional, but essential," he told them, stressing that God's name "must never be used to justify hatred and violence."
He referred to Somalia's al Shabaab Islamists' 2013 attack on Nairobi's Westgate shopping mall and this year's assault on Marissa university. Hundreds of people have been killed in the past two years or so, with Christians sometimes singled out by gunmen.
The chairman of the Supreme Council of Kenya Muslims, Abdulghafur El-Busaidy, called for cooperation and tolerance. "As people of one God and of this world, we must stand up and in unison," he told the pope.
Francis's African tour is also seeking to address the continent's fast-growing Catholic population, with the number of African Catholics expected to reach half a billion by 2050.
A third of Kenya's 45 million people are Catholics. Tens of thousands of them gathered in pouring rain from before dawn to attend the pope's open-air Mass in central Nairobi.
In his homily at the Mass, Francis urged the faithful "to resist practices which foster arrogance in men," speaking in a nation rattled by a series of corruption scandals.
President Uhuru Kenyatta, a Catholic who attended Mass, reshuffled his cabinet this week after several ministers resigned over graft allegations.
Giving his address in a sodden sports field at Nairobi University, the pope urged young people on a continent with a large young population to resist the "new deserts created by a culture of materialism and indifference" and build a more just society.
Purity Wanjiku, a 24-year-old, standing in a sea of people sheltering under umbrellas before Mass, said she wanted the pope "to talk to young people and tell them especially to spread the word of peace and also give us hope."
Thousands of police officers, some mounted on horses, were deployed in Nairobi to protect the pope and control the crowds.