Morocco said eight people were arrested on Tuesday over alleged plots to carry out attacks mainly targeting security officials on behalf of the Islamic State jihadist group.
The newly formed Central Bureau of Judicial Investigation, dubbed Morocco's FBI by the media, said an eight-member "terrorist cell" was dismantled across the country in the towns of Tangiers, Bouznika, Khouribga and Taounate.
The suspects had been in contact with IS leaders and given refuge to fighters who had received "intensive training in producing explosives and gang warfare", the interior ministry added.
It said members of the network, which included women, were planning "a series of terrorist operations" against security officials and sensitive sites.
They also had links with former Al-Qaeda fighters in Afghanistan, it said.
Morocco, which is on guard against deadly attacks of the type carried out by IS in Tunisia, prides itself on being a bastion in North Africa against Islamist extremism with its anti-jihadist unit and training of imams to preach tolerance.
An estimated 1,500 Moroccans, however, figure among the ranks of jihadist groups.