Facebook Spoofer Pardoned in Morocco
He said at his trial: "I admire him, I like him a lot and I have never caused him any wrong, it was just a joke. I am innocent."
His lawyer had pointed out that Facebook contained sites for President Sarkozy, George Bush and Tony Blair, as well as sport and film stars, without any proof that they were real.
Amnesty International, which condemned Mourtada's sentence as disproportionate to the offence, had been particularly worried by the judge's claim that he had "undermined the sacred integrity of the realm as represented by the prince".
His release from jail in Casablanca on Tuesday evening followed an international campaign for his release by human rights groups and ordinary internet users.
Reporters Without Borders, a media freedom campaign group, welcomed the royal pardon but added: "Nevertheless, we regret that his liberation was due to a royal pardon and not a fair verdict."
Mr Mortada's brother Ilyas told the BBC that Fouad was in good health, and was delighted to be free.
His lawyer said Mr Mourtada was still trying to come to terms with what had happened to him.