Moroccan police say they have dismantled a terrorist network in the making, arresting 17 people with links to members of al-Qaida.