They were among 32 people arrested more than two weeks ago after clashes that erupted in the port of Al-Hoceima when police tried to detain the head of the movement, Nasser Zefzafi.
His Al-Hirak al-Shaabi, or "Popular Movement", has been holding protests for weeks in the neglected northern Rif region, demanding jobs and an end to corruption.
Zefzafi was arrested on May 29 and is in custody in Casablanca awaiting trial, along with other leaders of Al- Hirak.
They were also accused of "taking part in an armed and unauthorised gathering".
More From This Section
Twenty-five were handed prison terms of 18 months each while the other seven were given suspended sentences and fined, said defence lawyer Mohamed Ziane.
"This verdict is a patent rejection of any kind of dialogue with the protesters," he said.
"This sad decision can fuel more protests, and is not the right one at all to find an end to this situation."
Al-Hoceima has been rocked by social unrest since the gruesome death in October of a fishmonger, who was crushed in a rubbish truck as he protested against the seizure and destruction of swordfish caught out of season.
Demands for justice snowballed into the wider grassroots movement.
Zefzafi's supporters have taken to the streets almost nightly since his arrest along with dozens of demonstrators and militants since the end of May.
The protests have been mostly peaceful and demonstrations in solidarity with Al-Hoceima have been staged in the nearby town of Imzouren and in the capital Rabat.