A Moroccan court has sentenced a French national and two Moroccans to life imprisonment for planning terrorist attacks in an attempt to overthrow the state.
The Frenchman was said to be the group's leader
The court also gave a variety of other sentences of up to 30 years to 30 other defendants in the case. Two of the accused were found innocent.
Frenchman Pierre Robert, 31, had denied all the charges and claimed he had been tortured in custody.
His trial was the most high profile of a series of cases of suspected Islamic militants arrested in the aftermath of the suicide bombings in Casablanca in May which killed 45 people.
Robert and the other defendants were not accused of carrying out the Casablanca attacks, but of plotting similar bombings in the northern city of Tangiers where they lived.
The court found them guilty of working as part of an umbrella Islamic extremist organisation called Salafia Jihadia, which has been blamed for carrying out the Casablanca attacks.
Robert, a French convert to Islam, was found guilty of being the leader of the group, giving them military and ideological instruction. His lawyers say they will appeal.
The five judges at the Court of Appeal in Rabat took 12 hours to deliberate, but did not sentence any of the defendants to the death penalty as the state prosecutor had demanded.
The sentences were handed out amidst heavy security in the courtroom.
One of the defendants shouted out "God is great" as he was led away after his sentence.
The prosecution had demanded the death penalty for Robert and 11 of his 33 Moroccan co-defendants.
In his most startling testimony, Robert said he had been working undercover for French intelligence, infiltrating Islamic extremist networks in Europe, BBC correspondent Sebastian Usher said.
The French Government has denied this.
The defendants were tried under Morocco's new anti-terrorism law which was rushed through parliament after the Casablanca bombings.