The 29-year-old man was arrested in the economic capital Casablanca "for his alleged involvement in the preparation of a terrorist scheme aimed at seriously undermining public order," Morocco's Central Bureau of Judicial Investigation (BCIJ) said in a statement.
The suspect had carried out "reconnaissance visits to identify certain security checkpoints, with a view to attacking them and using their weapons in terrorist operations", the BCIJ added.
The suspect had reportedly sought to "join terrorist organizations" including those based in sub-Saharan Africa, as well as in Syria and Iraq.
In 2003, Casablanca was hit by a dozen suicide bombers, killing 33 people and wounding dozens more.
Since then, Morocco has been spared major attacks, but its security services regularly report foiling plots.
Since 2002, Moroccan police claim to have dismantled 2,000 "terror cells" and arrested some 3,500 people in cases linked to terror, according to the BCIJ.