THIS HAS been a busy summer for Saudi Arabia’s judges. In June, seven government critics were sentenced to prison for allegedly using Facebook to incite protests . A human rights activist was sentenced to five years based on his writings , which criticized corruption and double standards among Saudi officials. Yet another man has been sitting in jail without charge or trial since February 2012 for three tweets that authorities alleged were insulting to the prophet Muhammad, according to Human Rights Watch.

And then, on July 29, Raif Badawi, who founded and ran a liberal Web site offering an outlet for free expression in this closed society, was convicted by a court in Jeddah and sentenced to 600 lashes and seven years in prison. His transgression? Mr. Badawi was accused of insulting Islam through his Web site and public comments. He got two extra years in prison for ridiculing Saudi Arabia’s Committee for the Promotion of Virtue and Prevention of Vice, the religious police. What did he say? According to Amnesty International, one of his articles thanked the morals cops “for teaching us virtue and for its eagerness to ensure that all members of the Saudi public are among the people of paradise.” Satiric, certainly, but worthy of time in prison? Hardly.

Mr. Badawi’s journey through Saudi Arabia’s medieval justice system began years ago. In 2008, he was arrested and questioned about his Web site but released, according to Human Rights Watch. Then he was charged with setting up a Web site that insults Islam, and he left the country. He returned when prosecutors apparently decided to drop the charges, but in 2009 he was barred from leaving. In 2011 prosecutors alleged that his Web site “infringes on religious values.” He was arrested in 2012, when a well-known cleric issued a religious ruling that Mr. Badawi was an apostate who must be tried. His Web site was shut down, and his family left Saudi Arabia. The only good news in all this: A judge threw out the charge of apostasy, which carries the death penalty, after Mr. Badawi assured the court that he is a Muslim.

Saudi Arabia’s arbitrary system of justice is based on interpretations of Islamic law by judges and prosecutors. This summer’s punishments highlight again the kingdom’s egregious intolerance of dissent and free speech. The barbaric punishment of 600 lashes for speaking one’s mind is shocking enough, but just as abhorrent in this day and age are criminal penalties for tweets and Facebook posts.

Last week, Saudi King Abdullah bin Abdul Aziz announced the donation of $100 million for the United Nations counterterrorism center, saying it would help “to get rid of the forces of hatred, extremism and criminality” that lead to terrorism. This lofty aspiration to set the world to rights would be far more credible if the kingdom showed the most elementary respect for freedoms at home.