By Philip Pullella and Mahmoud Mourad
CAIRO (Reuters) - Pope Francis warned against religious fanaticism on Saturday, wrapping up a brief trip to Cairo where he urged Muslim leaders to unite against violence by Islamic militants threatening to rid the Middle East of its ancient Christian communities.
Francis' trip comes three weeks after Islamic State killed at least 45 people in attacks on two Egyptian churches. He has used the visit to launch a strong appeal for religious freedom and to accuse extremists of distorting the nature of God.
After a dense first day of meetings with political and religious leaders, the highlight on Saturday was a Mass in the Air Defence Stadium, where Vatican officials said 15,000 people gathered, among them Coptic bishops and senior Anglican figures.
Crowds arrived early, waving Egyptian and Vatican flags and braving intense security measures to welcome Francis, who toured the sun-drenched stadium in a golf buggy to the sound of hymns performed by a choir and orchestra.
He blessed Egypt as one of the earliest nations to embrace Christianity and repeated his plea for tolerance.
"True faith leads us to protect the rights of others with the same zeal and enthusiasm with which we defend our own," he told the crowd in the heavily guarded arena.
"The only fanaticism believers can have is that of charity. Any other fanaticism does not come from God and is not pleasing to him," he said in his homily.
In a series of speeches during his two-day stay, the pope has delivered his bluntest denunciations yet against religious violence, and has appeared to endorse Egyptian President Abdel Fattah al-Sisi's campaign against Islamist militants.
However, he nuanced his message by lamenting the rise of "demagogic forms of populism" -- a possible reference to right-wing nationalist parties in Europe pushing anti-immigrant and anti-Muslim agendas.
He also defended human rights -- which non-governmental organisations have accused Sisi's administration of abusing.
"History does not forgive those who preach justice, but then practise injustice," he said in a speech on Friday, sharing the stage with Sisi, who warmly applauded his words.
The unusual choice of venue for Saturday's religious service highlights the security concerns surrounding the trip.
Helicopter gunships circled the perimeter of the stadium and armoured military vehicles patrolled the streets of the Egyptian capital on Saturday. Police in white uniforms were positioned every few metres (yards) on a Nile bridge that the pope crossed.
The 80-year-old pope himself declined the use of an armoured limousine, preferring instead to travel in an ordinary Fiat car with its window wound down so he could be closer to onlookers.
"The visit really supports national unity and shows that there is no fear but a fear of God," said Ehab Moheiy, 54, who attended the Mass. "Despite the bombings, the pope came and a celebration like this took place."
Francis had lunch with Egyptian bishops and later led prayers at a Catholic seminary in the south of Cairo, the final step of his 27-hour stay.
The visit was the first by Francis to Cairo but the second by a Catholic pope. Pope John Paul II came to Egypt in 2000, a year before the September 11 attacks on the United States that convulsed Western relations with the Muslim world.
"His two days in Egypt have turned Egypt into a paradise," Father Panteleimon, a priest from the north of the country, said enthusiastically after the open-air Mass. "Today is a celebration, today is a festival. Egypt is happy."
Egypt's Christians comprise 10 percent of the 92 million population, the largest Christian community in the Middle East. Most Egyptian Christians are Coptic Orthodox, while barely 200,000 are members of Churches within the Roman Catholic fold.
While Egypt has escaped the sort of sectarian violence that has decimated ancient Christian communities in Syria and Iraq, it is under threat from Islamic State militants who launched a campaign in December to wipe out Egypt's Christians, carrying out three church attacks that have killed more than 70 people.
The campaign presents a challenge for Sisi, who has vowed to crush Islamist extremist and is fighting a long-running insurgency in North Sinai, where Islamic State murders have forced hundreds of Copts to flee.
Sisi, who declared a three-month state of emergency after the Palm Sunday church attacks, appealed for more international cooperation to combat terrorism when he met Francis on Friday.
(Additional reporting by Arwa Gaballa and Amina Ismail; Writing by Crispian Balmer and Lin Noueihed; Editing by Giles Elgood)