The government said the group, who planned to declare 'holy war' in northeast Morocco, had recruited members of the police and the military and planned to rob banks and convoys and use the money to buy more explosives.
Khattab smiled to display his indifference as the judge read out the sentences late on Friday.
The court found the defendants guilty of plotting to bomb government buildings and tourism landmarks in Casablanca and other cities, and of belonging to an illegal group, collecting money to fund terrorism and undermining state security and public order.
Moroccan police have broken up more than 50 cells and arrested about 3,000 people since 2003, when suicide bombings killed 45 people in Casablanca.
Morocco and the neighbouring Maghreb countries have been on alert for attacks since al-Qaeda's North Africa wing stepped up suicide bombings and other attacks last year.
They fear a broad upsurge in violence in the region after al-Qaeda's Organisation in the Islamic Maghreb said it wanted to link up radical groups in the region and use it as a base for bombing European targets.
Algeria has suffered a series of deadly bombings since early last year, including a December 11 attack that killed 37 people.
In Morocco, six Islamists blew themselves up in Casablanca last year, killing one other person.
On Friday, the Dakar rally that goes through Morocco and Mauritania was cancelled for the first time in its 30-year history after threats from what organisers called "terrorist organisations".
In Mauritania, three attackers suspected of links to al-Qaeda shot dead four French tourists and wounded a fifth on December 24.
Armed men killed three soldiers three days later in a remote area in northern Mauritania, near the border with Algeria and Morocco's disputed Western Sahara territory.