Turkey's temporary ban on Twitter, Facebook, and YouTube Monday didn't come out of the blue. In recent years Turkish politicians have passed laws expanding the government's ability to censor the Internet, and more and more those new laws are being brought into play.

A Turkish court ordered the three social media giants blocked because users were circulating a picture of prosecutor Mehmet Selim Kiraz being threatened by the two Marxist gunmen who took him hostage last week. Mr. Kiraz and the militants were killed in a failed police raid to free him.

Agence France Presse reports that the government lifted the ban on Twitter and Facebook after several hours, following the companies' promise to remove the offending content. The news agency reported that negotiations with YouTube were ongoing.

Government officials condemned Turkish media for posting the image, which they have called anti-government propaganda. In addition to Twitter and YouTube, the court blocked 166 other websites that had distributed the photograph, according to The New York Times.

“Media groups ... publishing these photos are almost doing the propaganda of a terrorist organization,” presidential spokesman Ibrahim Kalin said in a news conference Monday. "Continuing to do so despite all warnings and criticisms is unacceptable."

Turkey has become one of the most aggressive censors of the Internet in the world under President Recap Tayyip Erdogan. Lucy Kafanov reported for The Christian Science Monitor Thursday that his administration’s suppression of information has seen 68,000 websites made inaccessible to average Turkish users, the French satirical magazine Charlie Hebdo among them.

President Erdogan appears to have an especially strong dislike for Twitter, which he has called “the worst menace to society.” In March 2014, the government blocked the site, along with YouTube, for two weeks after some Turks posted leaks from a corruption investigation that implicated prominent allies of Erdogan. Turkey leads the world in requests to remove tweets.

“Freedom of expression has always been problematic in Turkey ... but this is a new phenomenon of prosecutions for insults and blocking websites,” Kerem Altiparmak, professor of law at Ankara University, told Ms. Kafanov.

Reporters Without Borders ranked Turkey 149th out of 180 countries in its 2015 Press Freedom Index. In its annual report, the group says lawsuits and gag orders have successfully undermined freedom of information in the country.

Get the Monitor Stories you care about delivered to your inbox. By signing up, you agree to our Privacy Policy

But Mr. Altiparmak doesn’t anticipate much of a public backlash. “In other countries, this kind of trend might cause more opposition, but in our society, people have grown used to censorship.”

Some Turkish Internet users meanwhile have found ways around the latest ban by using Virtual Private Networks and other means That saw #TwitterisblockedinTurkey become a trending hashtag in the country and led to the creation of this (likely tongue-in-check) image: