Mouad Belghouat, 24, is known for his criticism of King Mohammed VI and was arrested on March 28 by plainclothes officers.
His Casablanca trial was delayed several times before Friday’s verdict, which his lawyer Omar Bendjelloun called “severe”.
He said he would appeal what he called “a trial against the freedom of expression” and a sentence that also included a 90-euro fine.
The charge against Belghouat stems from a YouTube video of one of his songs, which includes images of Moroccan police officers.
New York-based rights group Human Rights Watch said last month Belghouat “denies any link with this video, saying unknown people made the montage of photos and music using a separate recording of the rapper performing the song ‘The Dogs of the State’.”
The song is one of the most famous of the February 20 protest movement that is calling for far-reaching political reforms and anti-corruption measures in the north African monarchy.
Belghouat, nicknamed “Al-Haqed” (‘the Vengeful One’ in Arabic), performs songs critical of the monarchy that deal with themes of injustice and inequality.
One of the most famous songs openly criticises the king and his fortune.
Mohammed VI offered significant reforms curbing his near absolute powers in a bid to preempt the Arab Spring protests that last year felled leaders in Tunisia, Egypt and Libya, but still faces calls for deeper reforms.
During the last hearing before the verdict, the court had ordered a supporter of the rapper, Maria Karim, to be arrested and remanded in custody for “insulting” the police attorney.
The court decision led to the defence to withdraw.
“Because of the withdrawal, the defence lawyer’s final arguments could not be registered and the judge did not take this into account in his ruling,” said Bendjelloun.