Social media sites have called for fresh protests in Casablanca and Rabat next week after baton-wielding police dispersed demonstrations yesterday.
Daniel Galvan Vina, said to be in his 60s, was pardoned by King Mohammed VI and freed on Tuesday from jail in Kenitra, north of the capital.
He had been sentenced in September 2011 to 30 years in prison.
Galvan was among 48 Spanish prisoners released in response to a request from Spanish King Juan Carlos, who visited Morocco in mid-July, the justice ministry said.
More From This Section
The investigation should "determine the responsibilities and the failures that led to this regrettable release," the statement said.
"The king was never informed -- in any way or at any time -- of the seriousness of the abject crimes of which the person concerned was convicted," the palace added.
"It is clear that the sovereign would never have consented" to his release, given the "monstrous crimes" committed, the statement concluded.
The incident has sparked outrage in the north African country, which has seen several high-profile paedophile arrests in recent months.
Yesterday night, baton-wielding police dispersed several thousand people who tried to protest in front of the parliament in Rabat.
Dozens were injured, including reporters and news photographers, and some had to be hospitalised.
Others were held outside the Moroccan embassy in Paris on Saturday and in Kenitra, where the man had been held.
Police also broke up demonstrations in Tanger and Tetouan.
Protesters slammed the pardon as "an international shame" with one demonstrator saying the state "defends the rape of Moroccan children".