When we think of online censorship, the first thing that comes to mind is totalitarian governments like China. But Google is one of the biggest unofficial Internet censors in the world.

In order for Google (GOOGL) to operate in the 219 countries and territories it does business in, the search giant has to obey local laws and rules -- many of which require Google to remove certain content from its search results and other sites.

So in Turkey, Google takes down links to sites that defame the country's founder, Mustafa Kemal Ataturk -- that's illegal there. In Thailand, denigrating the Thai monarch is against the law, so Google blocks YouTube videos in Thailand that ridicule King Bhumibol Adulyadej.

And in Germany, France and Poland, where it is illegal to publish pro-Nazi material or content that denies the Holocaust, Google does not display links to certain sites on its search results pages.

Governments asked Google to remove 39,374 items from its search results, YouTube and other sites in 2013, according to the company's most recent transparency report.

On top of that, copyright holders asked Google to take down 36.5 million links, videos and other items.

Google does not provide data on how many take-down requests it complies with, but the company provides examples of requests it accepts and denies.

For instance, Russia wanted a blog post that contained the text "got chocolate" removed last year, claiming it violated a federal law. Google complied because in Russian, "chocolate" can also reference a recreational drug, and the country has a law that requires the removal of drug-related content.

But when the Georgia Department of Corrections requested a YouTube video depicting alleged abuse of inmates to be taken down, Google denied that request because the video did not violate any state or federal laws.

Related: Banned! 8 things you won't find in China

The fastest-growing source of Google censorship is Europe's controversial "Right to be Forgotten" law.

In May, the European Court of Justice ruled that people can ask Google to remove sensitive links from its search results. Google said that it had received nearly 700,000 requests so far. Of that total, it has removed 40% of the links -- according to the law, Google can decline the requests if it believes the links in question are in the public interest.

In the interest of an open Web, Google has fought some take-down requests -- sometimes all the way to countries' top courts.

In 2010, Google became so exasperated by China's censorship demands that it pulled its business out of the country altogether. At the time, Google said it would abide by censorship demands from democratically elected governments, but Chinese people did not have the ability to choose the leaders making the censorship demands.

"For our own websites and for the Internet as a whole we have worked tirelessly to combat internet censorship around the world," Google co-founder Sergei Brin said in a 2011 blog post. "I am proud of the role Google has played."

Yet Google plays both sides of the fence. Though it doesn't operate in China, it does operate in other countries with dictatorships or monarchies, including Zimbabwe and Thailand. Google declined to comment for this story.

Censorship doesn't only happen abroad. Google removes links and other content from its sites in the United States too.

For instance, Google says it is proactive about removing links to sites or videos that contain child pornography, which is illegal in the United States. (Google has a policy of censoring those results in every nation, even those that do not have laws against child porn.)

Some countries give Google and other search companies terms and topics that are considered illegal, and it is up to Google to determine whether a certain site breaks local law. Other countries make ad-hoc requests to take down certain links or content.

Related: The Great firewall of china is nearly complete

When a country asks Google to remove content or links, Google's lawyers examine the request to determine if it is, in fact, against that nation's laws. Often Google will negotiate with that country's authorities to narrow the scope of the requested restriction. And on occasion, Google doesn't comply, and countries determine whether they should take it upon themselves to restrict access for citizens.

Google controls nearly two-thirds of the world's search results, making it one of the biggest Internet gateways for more than a billion people around the world. That's why Google attempts to be transparent about the content it removes from the Web.

Any time Google censors something, it notes it in a public log on its transparency report. Google also provides a link to chillingeffects.com, a Web site run by Harvard's Berkman Center that records online content that has been censored.