Pope Francis arrived in Morocco on Saturday for a visit which will see him meet Muslim leaders and migrants ahead of a mass with the country's minority Catholic community.
The spiritual leader of the world's 1.3 billion Catholics was invited by King Mohammed VI as part of a mission on the "development of interreligious dialogue", according to Moroccan authorities.
Improving relations with other religions has been a priority for the Argentine pontiff, whose papacy has been marred by a wave of child sex abuse allegations against clergy.
The pope's plane landed in the capital Rabat shortly before 2 pm (1300 GMT) and he was greeted by the king who is known as the "commander of the faithful" in Morocco, where 99 percent of the population is Muslim.
The Moroccan capital has stepped up security ahead of the first papal visit to the North African country since John Paul II in 1985.
Buildings have been repainted, streets decorated and lawns manicured for the pope's two-day visit.
Francis was to be presented on arrival with dates and almond milk, before stepping into the popemobile and the monarch into a limousine.
They were to drive to a welcome ceremony at the Tour (or tower) Hassan mosque and a mausoleum, attended by 25,000 and beamed onto giant screens, before the king hosts Francis at the royal palace.
Wellwishers began packing the esplanade outside the 12th century incomplete mosque from midday as rain drizzled on them while others, including many Moroccans in traditional costume, lined the roads nearby.
Red carpets covered the ground at the entrance to the esplanade and two armchairs, red as well, were placed on a platform in front of the mosque.
Francis will also visit an institute where around 1,300 students are studying to become imams and preachers, teaching "moderate Islam" and backed by the king.
"It's a very significant event, the first time that a pope is welcomed to an institute for the training of imams," said Vatican spokesman Alessandro Gisotti.
During the visit, Francis is due to hear from two students -- one African and one European -- as well as a statement by Morocco's Ministry of Islamic Affairs.
A concert drawing inspiration from Islam, Christianity and Judaism is also on the agenda.
Last month Francis visited the United Arab Emirates, where he met with Sheikh Ahmed al-Tayeb, the imam of Cairo's Al-Azhar, Sunni Islam's prestigious seat of learning.
The two signed a document on "human fraternity for world peace", which among other things called for "freedom of belief" and "full citizenship" rights for minorities.
Francis will not hesitate to refer to the text, which from now on he will give to all heads of state, Gisotti said.
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 if they are not born into the Jewish community, apostasy is socially frowned upon, and proselytising is criminalised.
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 is due to finish his Saturday schedule by meeting migrants at a centre run by Catholic humanitarian organisation Caritas.
The charity runs day centres for migrants who are trying to reach Europe across the Mediterranean, as well as supporting their access to services.
The number of people taking the sea route from Morocco to Spain has increased recently due to the closure of the border with Libya.
In 2017, Caritas centres in Rabat, Casablanca and Tangier welcomed 7,551 new arrivals, according to the charity.
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.
Francis has throughout his papacy highlighted the plight of migrants and refugees, calling on Catholics as well as politicians to show solidarity with those in need.
On Sunday, the pope will celebrate mass at a Rabat stadium with an estimated 10,000 people attending.