A Moroccan court on Monday sentenced rapper Mohamed Mounir, known as Gnawi, to one year in jail for insulting police on social media, in what Amnesty condemned as "a disgraceful verdict".
A defence lawyer said he believed his 31-year-old client was prosecuted because of a song he co-wrote about the hardships of young people in Morocco, unemployment and corruption.
Gnawi went to trial on Monday after Moroccan authorities arrested him.
The song "Aach al Chaab" -- which means long live the people -- has been viewed more than 15 million times on YouTube since it was released last month.
The lyrics denounce injustice and money-grabbing and attack Morocco's king directly, which according to local media constitutes a clear breach of the kingdom's "red lines".
However, the court in Sale near the capital Rabat sentenced Gnawi to one year in jail and fined him 1,000 dirhams ($103) for "insulting a public servant", a reference to the police.
Gnawi, who was arrested November 1, said he had insulted the police in a video which he posted on his Instagram account because he had been "humiliated" by them.
Banner in Arabic reads "Freedom to Gnawi" and "Long live the people".
"I am an artist. My job is to defend my rights and the rights of the people. It was not the first time that I had been humiliated by the police," Gnawi told the court.
"Since I was born, I have been humiliated," he said.
Outside the courtroom, Gnawi's relatives chanted "long live the people".
"This is a disgraceful verdict. There can be no justification for imprisoning the Moroccan rapper Gnawi for a year simply because he exercised his right to freedom of expression," Amnesty International said.
"International law protects the right to freedom of expression - even when the opinions shared are shocking or offensive," said Amnesty's Middle East director Heba Morayef.
A protester carries a banner with the title of a rap song called Long Live the People.
"This verdict... indicates that those who dare to openly criticise the authorities will face punishment," Morayef said in a statement.
The case has also sparked outrage on social media, but Mustapha Ramid, Morocco's minister of state in charge of human rights, told parliament that "Aach al Chaab" was "provocative" and "repugnant", according to media reports.
Young people make up a third of Morocco's 35 million inhabitants. A quarter of those aged between 15 and 24 are unemployed and out of school, according to official figures.
Agence France-Presse