RABAT (Reuters) - Morocco on Thursday sentenced a man to four years in prison on charges he insulted the king on YouTube, and authorities arrested a rights activist who on Twitter criticized long jail terms for protesters seeking social justice.

Mohamed Sekkaki, who has a popular following on YouTube, shared a video last month criticizing King Mohammed’s speeches and calling the Moroccan people “donkeys” and “stupid.”

A court in Settat, 135 km (84 miles) south of Rabat, sentenced him to four years in jail and a fine of 40,000 dirhams ($4,150) on charges that included insulting Moroccans and constitutional institutions. His lawyers said he would appeal the verdict.

Separately, rights activist Omar Radi was arrested in Casablanca on a charge of insulting a judge in a tweet, his lawyer Miloud Kandil said.

Moroccan rights groups are increasingly concerned at what they see as attacks on personal freedoms in the North African kingdom, including arrests in connection with political attacks on the authorities.

King Mohammed VI ceded some powers to an elected government after the Arab Spring protests in 2011, but he still has the final say on important issues. Demonstrations demanding social justice broke out in the Rif mountain region in 2016.

Radi criticized a judge for giving heavy prison sentences to leaders of the Rif protests, which focused on economic and social problems in a country where inequality is rampant.

He has been remanded in pre-trial custody, Kandil said, and his next hearing will be on Jan. 2. Radi also worked as a journalist and was an activist in the 2011 protests.

It comes a month after rapper Mohamed Mounir, known as Gnawi, was sentenced to a year in prison for insulting the police in a video on social media.

Freedom Now, a Moroccan rights group, said prosecution of social media users who voiced anger at social and economic conditions were an attack on free expression.