A man ran towards a car carrying the Moroccan king shortly after the arrival of Pope Francis in the North African nation on Saturday.
He was swiftly seized by security guards, live TV footage from the state broadcaster showed.
King Mohammed VI was standing up in the open-top car waving at crowds lining a street in Rabat, travelling in a motorcade
alongside the pope's vehicle.
The king's car sped up slightly, but there was no other sign of disruption.
It was not immediately clear what the man was trying to do.
Man killed in level crossing train crash 'worked for railway company'
The pope is on a two-day visit to Morocco.
His trip will be focused on boosting interfaith dialogue.
The monarch is known as the "commander of the faithful" in Morocco, where 99% of the population is Muslim.


British tourist, 53, found dead floating in Canary Island hotel pool
Pope Francis will visit an institute where around 1,300 students are studying to become imams and preachers, teaching "moderate Islam" and backed by the king.
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.