The federal prosecutor's office said the 59-year-old suspect identified only as Bagdad A. was believed to have worked as an agent for the Moroccan secret services in Germany from May 2007 to February this year.
"The accused has a broad network of contacts among Moroccans living in Germany," it said in a statement.
"In 2007, he told the Moroccan foreign intelligence service he was willing to use his contacts to provide information about Moroccan opposition members living in Germany."
It said he remained in "constant" contact with his employers until February this year and informed them in particular about demonstrations held by opposition groups.
A spokesman for the prosecutors said the man was not currently in custody but that the authorities had determined there was little risk of flight as his family lived in Germany.
On Wednesday, a German court gave a two-year suspended jail sentence to a 48-year-old man of dual German-Lebanese nationality for spying on opponents of the Syrian regime in Germany.
The man, identified only as Mahmoud El A., was found guilty of "espionage activities," court spokesman Tobias Kaehne said.
The court in Berlin "was persuaded that the accused spied on members of the Syrian opposition and passed on the information to the Syrian secret service," added Kaehne. "The accused basically admitted" the charges against him, said Kaehne.
The man was active between April 2007 until his arrest on February 7 in 2012. He passed on the information he received to a handler during regular meetings in Berlin, which increased in frequency after the outbreak of the "Arab Spring" in 2011.