On Sunday, Turkey will hold nationwide municipal elections, and while local elections do not generally make international news, this one is different: The Turkish government has banned YouTube and Twitter in an apparent attempt to stifle political criticism, prompting a worldwide backlash. Add that to months of often bloody street protests against policy actions, and the impression is of a government in crisis.

Turkish Prime Minister Recep Tayyip Erdoğan and his Islamist-leaning AK Party have been at the top of Turkish politics since 2002, but they seem to be facing one of their biggest challenges yet. Erdoğan's approval ratings have dropped from 59.1 percent a year ago to 43.5 percent last month, and many of his key allies are caught up in a huge corruption scandal.

While much of the media might focus on the Turkish government's social media bans and the street protests, these are only  symptoms of the deeper political problems in Turkey that Erdoğan's government is facing. Some of these problems are easy for outsiders to understand – accusations of corruption and of creeping social conservatism, for example. But other issues are quite specific to Turkey -- for example, the "deep state" and the Gülen movement.

Those outside of Turkey might not have heard of deep state and Gülen, which is understandable, since even within Turkey many people don't seem quite sure what to make of them. But they are important to understanding all the wild talk of censorship, coups, wiretaps and leaks coming out of Turkey right now.

First, some background. The modern Turkish state was founded by Mustafa Kemal Atatürk in 1923. He transformed what had been the Islamic Ottoman empire into a secular republic after the empire's humiliation during World War I. Atatürk was a military officer during the war, and the military has continued to play a huge role in Turkey's political life since then, viewing itself as the "guardian of Turkish democracy." The military has stepped in a number of times to remove civilian governments when it felt they were moving too far away from secularism or anti-Communism. Islamist movements in the country were largely suppressed, and devout politicians often faced jail time (Erdoğan himself went to jail in 1999).

The rise of the AK Party in 2002, with its moderate Islamist position and pro-business policies, appeared to have brought that era to an end. In recent years, two trials have targeted  alleged military-linked plots against the government (known as "Ergenekon" and "Sledgehammer").

A "deep state" within Turkish politics

In Turkey, it's widely believed that there are secret networks within institutions such as the military, judiciary and the intelligence community -- what is referred to as the "deep state." These networks are suspected of working to control the Turkish political system through criminal, undemocratic means.

Though the idea of secret networks might sound like the stuff of conspiracy theories,there's a good amount of evidence that deep state did exist, even outside of the military coups mentioned above. Deep state groups are widely believed to have played an important role in Turkey's "dirty war" against Kurdish minorities in southern Turkey from 1980 to the mid-'90s. Thousands of people linked to the Kurdistan Workers Party are thought to have been kidnapped and murdered.

In a 2012 article in the New Yorker, reporter Dexter Filkins described death squads:

Death squads in predominantly Kurdish cities like Diyarbakır operated with near-impunity, even using a signature vehicle: a white Renault sedan, in which military-age Kurdish males were often taken away. “Whenever you saw a white Renault, the streets would empty,” Selahattin Demirtaş, the head of the Peace and Democracy Party, the main Kurdish political party, told me. “I’ve been inside the Renaults. A lot of people I know never made it out of them.”

Deep state networks allegedly not only attacked political enemies but also acted as agent saboteurs, working to create an atmosphere of fear and division that could be used to further their own aims.

These days, the deep state's existence is accepted public opinion in Turkey. But for a long time, there was no consensus on who might be involved, or even on what deep state actually was. In 2007, Erdoğan himself reportedly told a Turkish TV channel that deep state had always existed, even going back to the Ottoman Empire.

For many observers, it was the "Ergenekon" and "Sledgehammer" trials that finally proved the existence of the deep state. Ergenekon, which refers to a mythical place in the Altai Mountains, was said to be a clandestine, ultra-nationalist organization that aimed to bring down the AKP government. Some 275 people alleged to have been involved in the organization were brought to trial and were sentenced to prison terms last year. In the Sledgehammer case, secular military officers were accused of plotting to overthrow the government, and more than 300 people were  sentenced to prison in 2012. In both cases, questions have been raised about the evidence used to convict (for more on that, see Filkins's 2012 article).

The Gülen movement

Much like deep state, people have trouble defining exactly what the Gülen movement is. Followers refer to Gülen as Hizmet, or "the service," and basic facts about its founder, Islamic cleric Fethullah Gülen, are in dispute. Official literature lists his birth year as both 1938 and 1941, according to Joshua Hendrik's excellent "Gülen: The Ambiguous Politics of Market Islam in Turkey and the World."

What we do know is this: Gülen has created one of the most successful religious movements in the world, promoting a branch of Sunni Muslim belief that also promotes inter-faith dialogue, a pro-business stance and education – his movement is believed to be behind 135 charter schools in the United States alone. In 2008, he was voted the world's top public intellectual in a poll by Foreign Policy magazine. He's believed to have millions of followers worldwide.

Gülen's importance in Turkey is hard to overestimate, but he hasn't lived there since 1999. Instead, he makes his home in the United States, on a quiet street in Saylorsburg, Pa. Gülen left Turky 1999, saying that he needed medical treatment. But his departure appears to have been prompted by something else: He was facing criminal prosecution after leaked audiotapes allegedly suggested that he was working to install an Islamic government (he was acquitted of these charges in 2008).

Gülen rarely speaks in public and grants few interviews, but critics say he exerts huge power. When an investigative journalist named Ahmet Şık tried to publish a book (“The Imam’s Army”) examining the movement -- and linking it to the Turkish police -- he ended up in jail as part of the Ergenekon case, and the book was banned in Turkey. The New York Times reported last year that "a culture of fear" surrounded the group and that "few here will talk openly about them on the telephone, fearing that their conversations are being recorded and that there will be reprisals."

Why deep state and Gulen matter

The AKP and the Gülen movement were allies for a long time, sharing moderate Islamic views and a pro-business policy. As Christopher de Bellaigue recently put it in the New York Review of Books, AKP's success could be attributed to an "unofficial coalition with less visible Islamists, and their most powerful coalition partner was the movement of Fethullah Gülen." Part of the reason for the Islamist movement's success was that it appeared to finally be putting an end to the excesses of the secularist military and the deep state. The Ergenekon and Sledgehammer cases seemed to be both retribution and a sign that a new era had begun.

But Gülen and AKP have clearly fallen out in the past few months. Erdoğan has blamed Gülen's followers in the police and judiciary for the corruption probe against his allies. He has also claimed that Hizmet was behind a series of audiotape leaks of alleged phone conversations by Erdoğan himself  and of alleged top-secret security meetings discussing Syria. Gülen, for his part, has said that the crackdown on his followers has been "10 times worse" than the era of army coups.

The argument made by the AKP is that the Gülen movement has replaced the traditional secular military state with one of their own. Erdoğan has even begun to disavow the Ergenekon trials, the very court cases that painted his government as the Islamist movement that finally brought down the secular deep state.

Of course, this all sounds rather conspiratorial, but even skeptics of the deep state and those who say that fear of the Gülen movement is exaggerated have to wonder what is going on. Erdoğan's government has confirmed the authenticity of the latest leak, which suggests that someone with access to the very top of Turkish government is working against AKP. As one Turkish academic put it to me, if it isn't the Gülen movement, who is it?

On some level, it doesn't even matter if claims of a deep state and fears of a Gülen movement are trustworthy: People believe them. And it's that belief that leads Erdoğan to ban YouTube and Twitter in attempt to demonize those who are spreading the rumors and leaks against his government. In this way, he appears to be trying to cement his reputation as the democratically elected leader who took on the deep state, whether it was Gülen-led or not.