Daniel Galvan Vina, a Spaniard found guilty of raping 11 children aged between four and 15 in Morocco and sentenced in September 2011 to 30 years in prison there, was detained in Murcia in southeastern Spain, a Spanish interior ministry spokesman said.
Galvan, who once worked at the University of Murcia, will be taken to Madrid to appear before Spain's top criminal court, the National Audience, which will decide his fate, the spokesman added.
The 63-year-old was among 48 Spanish prisoners who were pardoned by King Mohamed VI and freed last week from jail following a visit in mid-July to Morocco by Spain's King Juan Carlos.
A royal palace statement said the king had been unaware of the nature of Galvan's crimes and had ordered a probe into his release.
Earlier on Monday the Moroccan monarch dismissed the director of prisons after an enquiry blamed his department for Galvan's release under royal pardon.
"The enquiry concluded that the said administration inadvertently provided erroneous information about the criminal record of the prisoner in question when requested by the royal court," a palace statement said.
The pardon sparked outrage in Morocco, which has seen several high-profile paedophile arrests in recent months.
Galvan was convicted after videos he made of his crimes at his home in Morocco were used as evidence.
On Friday night, baton-wielding police dispersed several thousand people who tried to rally in front of the parliament in Rabat.
"We still don't understand what is behind this affair," said primary schoolteacher Fatima Imelouane, who took part in a protest held Friday in the Moroccan port of Kenitra where Galvan once lived.
"Why this pardon? Why the revocation? Who is responsible and what are the government and the justice minister (Mustapha Ramid) doing?" she asked.
New demonstrations were planned for Casablanca on Tuesday and Rabat on Wednesday.
The Moroccan justice ministry said Galvan and the 47 other Spanish prisoners received the royal pardon in response to a request from Spain's king.
But Spain's royal household said Juan Carlos had not asked for the release of Galvan or any other Spanish prisoner during his visit and had only shown interest in the wellbeing of Spanish nationals held in prisons in the north African country.
"At the request of the associations representing family members of Spanish prisoners, the king showed interest in the situation of Spanish prisoners in Morocco" during a meeting with King Mohamed VI, a spokesman for the royal household said.
"We had nothing to do with the drawing up of any list."
The Spanish embassy in Morocco had asked for 30 prisoners including Galvan to be repatriated to serve the rest of their sentences in Spain and for 18 others to pardoned, a source close to the process told AFP.
Daily newspaper El Pais reported that Galvan told his Moroccan lawyer that he was a former official in the Iraqi army who had worked with foreign secret services to oust Saddam Hussein.
The name Daniel Galvan was "an identity that was fabricated by secret services when they got him out of Iraq, they provided him with Spanish documentation and converted him into a retired professor from Murcia," the newspaper added.
Galvan worked at the international relations department of the University of Murcia between 1996 and 2002, a spokesman for the university said.
He was a fellow at the university during the first two years and then a member of the administration charged with developing the institution's ties with the Arab world, the spokesman added.
"In 2002 he said he would not bid to renew his contract and since he cut ties with the university we have never had any contact with him," the spokesman said.