Authorities arrested the five from the youth movement of Prime Minister Abdelilah Benkirane's Justice and Development Party (PJD), the source said, after the assassination of Andrei Karlov on December 19.
The Akhbar Al-Yaoum daily reported a sixth person had been called in for questioning.
Gulen network 'behind' killing of Russian ambassador: Turkish FM
The PJD, whose leader has been tasked with forming a new governing coalition after winning October parliamentary polls, has yet to comment on the arrests. But the head of the party's lawyer association, Abdessamad al-Idrissi, said he would be defending those detained.
Under Moroccan law, the crime of justifying terrorist acts can be punished by up to six years in prison and more than $19,000 in fines.
On December 22, the justice and interior ministries said they were opening an investigation after a group of people "clearly celebrated on social media the assassination of the Russian ambassador in Turkey".
Russian ambassador shot dead in Turkey attack
In early December, Benkirane caused a diplomatic stir by criticising Russia's military intervention in Syria in support of President Bashar al-Assad's regime.
After Moscow's envoy in Rabat expressed concern over the comments, Morocco's foreign ministry slammed the premier's remarks and said it respected Russia's role in Syria.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ