Moroccan authorities say they have dismantled two terrorist cells with al-Qaida links and detained the groups ' members .