A Malian living in Morocco that had been in contact with one of the groups was also arrested. The statement did not elaborate how many people had been detained in total.
Morocco frequently announces dismantling small cells planning terrorist attacks inspired by al-Qaida, but the terror network is not believed to have a real presence in this North African kingdom of 32 million people.
Early in the month, the government announced dismantling two other cells, one planning to set up a training camp in the northern mountains, another hoping to get in touch with al-Qaida and attack tourist sites.
Morocco's last major terrorist attack was in April 2011, when a bomb exploded in a cafe popular with tourists in Marrakech, killing 17.