Muslim groups have tried to stop the publication of a Zapiro cartoon.
The Islamic theological body, the Jamiatul Ulama on Thursday tried to prevent the Mail & Guardian from publishing the cartoon by applying for an urgent interdict in the Johannesburg High Court.
The offending cartoon depicts the prophet lying down on a therapist's chair, saying: "Other prophets have followers with a sense of humour!"
Beside him is a newspaper with a headline reading: "Everybody draw Muhammad day". Behind him, a bespectacled therapist wearing a suit and bowtie is seen taking notes.
The Jamiatul Ulama claimed the cartoon was offensive and could cause violence in South Africa.
The order, however, was not granted. The Jamiatul Ulama took the application to court on the same day that Pakistan ordered internet service providers to block Facebook amid anger over a page that encouraged users to post images of Muhammad.
Jonathan Shapiro, better known as Zapiro, insists he was not trying to offend Islam when he drew the cartoon.
"I believe that all religions should be subjected to satire and that some religious groups should not be able to think they are above society.
"I did not try to draw a cartoon that is as offensive as possible, I just drew a cartoon that is challenging. The prophet in the cartoon looks sad his followers don't have a sense of humour, are so fanatical and sensitive," he said.
Earlier this year, South Park, the American animated TV series depicted Muhammad in a bear suit. Following death threats and calls for censure, a cartoonist started a global campaign called "Everybody Draw Mohammed Day!"
"I joined (the campaign) because people were getting scared. It was a day of solidarity for cartoonists to draw the prophet. Maybe I was naive as I did not think the cartoon or the paper would be interdicted. I thought I would get away with it, but I am glad for the freedom of expression in South Africa," said Shapiro.
The ruling was hailed by media institutions and legal experts, and the SA National Editors' Forum issued this statement: "Sanef does not comment on the contents of newspapers. We, however, want to emphasize the right of editors to publish that which they deem fit to do so. There are crediibl self regulatory mechanisms available to people who might be unhappy about the content of a newspaper or electronic broadcast."
Dario Milo of the law firm Webber Wentzel said: "Our courts have decided that even expression which is regarded as offensive must be protected under the constitution," Dario Milo of the law firm Webber Wentzel said.
His comments were echoed by ProJourn.
"This is an important judgment, it is in support of the media to report on issues without fear or being intimidated," said ProJourn secretary general Samantha Perry.
Shapiro joked that, at the very least, he could not be labelled an Islamophobe.
"Some of the people who have been criticising me are the same ones who applaud cartoons about Israel on infringing Palestine's rights."