Pope Francis has called on Moroccans to fight fanaticism during a visit to promote inter-faith dialogue.
He was met at the airport by King Mohammed VI and driven to the capital Rabat, where he gave a speech.
The pontiff is to meet migrants and Muslim leaders, and hold a Mass for the country’s small Roman Catholic community this weekend.
The Vatican considers the papal visit a continuation of last month’s historic trip to the United Arab Emirates.
To a crowd of thousands, Pope Francis said it was “essential to oppose fanaticism” and for the faithful to “live as brothers”.
He defended “freedom of conscience” and “religious freedom” as fundamental for human dignity, and said it was “necessary” to make the “appropriate preparations of future religious guides”.
Since 2015, 1,600 young Moroccans are estimated to have been radicalised and joined jihadists fighting for the Islamic State group.
King Mohammed said the key to tackling radicalisation of young people was to increase religious education.