In a joint statement, the two leaders said Jerusalem was “common patrimony of humanity and especially the followers of the three monotheistic religions.”
“The specific multi-religious character, the spiritual dimension and the particular cultural identity of Jerusalem… must be protected and promoted,” they said in the declaration released by the Vatican as the pontiff visited Rabat.
The Moroccan king chairs a committee created by the Organisation of Islamic Cooperation to safeguard and restore Jerusalem’s religious, cultural and architectural heritage.
The joint statement came after US President Donald Trump’s landmark recognition of the disputed city as capital of Israel, which sparked anger across the Muslim world, especially from Palestinians who see Jerusalem as the capital of their future state.
Improving relations with other religions has been a priority for the Argentine pontiff, whose papacy has been marred by clergy facing a wave of child sex abuse allegations.
Addressing thousands of Moroccans who had braved the rain to attend the welcome ceremony, Francis said it was “essential to oppose fanaticism”.
He stressed the need for “appropriate preparation of future religious guides”, ahead of meeting trainee imams later on Saturday.
Catholics are a tiny minority Morocco, where 99 percent of the population is Muslim. The king is revered across West Africa as “commander of the faithful”.
Speaking at the ceremony at the Tour (or tower) Hassan mosque and nearby mausoleum in Rabat, the monarch also voiced opposition to radicalism.
“That which terrorists have in common is not religion, it’s precisely the ignorance of religion. It’s time that religion is no longer an alibi… for this ignorance, for this intolerance,” he said.
Francis rode to the ceremony in his Popemobile, passing rows of Moroccan and Vatican City flags and an estimated 12,000 well-wishers who packed the esplanade.
Buildings had been repainted, lawns manicured and security stepped up ahead of the first papal visit to Morocco since John Paul II in 1985.
A 17-year-old was arrested after trying to throw himself onto the king’s limousine to seek the monarch’s help, the police said.
Some 130,000 people across Rabat watched the first stage of the pope’s visit, which was beamed onto giant screens, officials said.
‘Right to a future’
After stopping by the royal palace, Francis and Mohammed visited an institute where around 1,300 students are studying to become imams and preachers.
There they heard from a French and a Nigerian student of the institute, which teaches “moderate Islam” and is backed by the king.
In Morocco, where Islam is the state religion, authorities are keen to stress the country’s “religious tolerance” which allows Christians and Jews to worship freely.
But Moroccans are automatically considered Muslim, apart from a minority who are born Jewish. Apostasy is socially frowned upon, and proselytising is a criminal offence.
Those who try to “rock the faith of a Muslim or to convert him to another religion” risk a prison term of up to three years.
After years in the shadows, since 2017 the small number of converts have called openly for the right to live “without persecution” and “without discrimination”.
Around 30,000 to 35,000 Catholics live in Morocco, many of them from sub-Saharan Africa.
The pope finished his Saturday schedule by meeting migrants — including children dressed in colourful hats — at a centre run by Catholic humanitarian organisation Caritas.
“Everyone has the right to a future,” said Francis, who has throughout his papacy highlighted the plight of migrants and refugees.
He criticised “collective expulsions” and said ways for migrants to regularise their status should be encouraged.
Caritas centres in Rabat, Casablanca and Tangiers welcomed 7,551 new arrivals in 2017, according to the charity, helping migrants access services.
The number of people taking the sea route from Morocco to Spain has recently surged as it has become harder for them to pass through Libya.
Rabat claims to have a “humanistic” approach to migration and rejects allegations by rights groups of “brutal arrest campaigns” and “forced displacement” to the country’s southern border.
On Sunday, the pope will celebrate mass at a Rabat stadium with an estimated 10,000 people attending.