The Obama administration’s ambassador designee for Turkey John Bass recently had a bad day before the Senate Foreign Relations Committee, because he had difficulty explaining what is happening in Turkey before finally conceding that its government was “drifting towards” authoritarianism. I have just returned from a visit to Istanbul where I was able to talk to academics, journalists, businessmen, industrialists, and security officials, and can report that Bass’s comment was widely reported in the local media. Both foreign and domestic perceptions of what is taking place in Turkey are indeed generally framed around Prime Minister Recep Tayyip Erdogan’s alleged authoritarianism and religious conservatism opposing the constitutionalism and secularism of his opponents, but of course reality is not quite that simple.

On August 10th Erdogan will be running in the first ever direct election for president of Turkey. He is ramping up his anti-U.S. and anti-Israel rhetoric to appeal to his base, and promises to bring with him a “revolution” to transform and gain control over every aspect of the government and society. He will almost certainly quickly move to enhance the power of his office by revising the constitution. Polls predict that he will win even though more Turks oppose him than support him, thanks to a fragmented opposition and his own core of dedicated followers that the other candidates cannot match.

Erdogan supporters have been lampooned as barely educated and deeply religious Anatolian peasants, but the prime minister’s populist and religious message touches them and they return the favor with their votes. It has been reported in the Turkish media that they revere Erdogan, sometimes referring to him as “the Caliph” and even as “Allah,” surely a blasphemous epithet. Some observers point to Erdogan comments suggesting that he sees elections as a tool rather than as an end, leading to criticisms that he promotes what Fareed Zakaria describes as “illiberal democracy.” Others discern a design to restore something like the Ottoman Empire in Erdogan’s plan to build a “Great Turkey” by 2023, the 100th anniversary of the founding of the Turkish Republic by Mustafa Kemal Ataturk.

To be sure, Erdogan has done some very good things for his country in his 11 years as prime minister. He has presided over a booming economy evident in the buildings springing up everywhere in Istanbul and the cars on the street, which are largely new and represent many expensive marques. I even saw a Ferrari. And he has succeeded in establishing a modus vivendi with the country’s large Kurdish minority by allowing the community to have access to its own language and culture. The ongoing conversation has greatly reduced the level of violence and there have been similar moves to apologize to the country’s Armenian minority and come to an arrangement over the Turkish Republic of Northern Cyprus.

Erdogan has also broken the power of the army, which had intervened in Turkish politics four times since 1960. His elimination of the Kemalist military’s role as guarantor of the secular constitution enabled the open government encouragement of Islam, but also resulted in false arrests and imprisonment of hundreds of former and current officers. A subsequent show trial that exposed an alleged conspiracy called “Ergenekon” was widely criticized for its procedural errors. Many of the officers have since been released and will be retried.

And Erdogan undoubtedly blundered in a big way when he supported an armed insurgency against the Syrian government. He assumed that the opposition would succeed in fairly short order and a regime friendly to Turkey and less reliant on Iran would arrive in Damascus. Instead, Turkey has been assigned a supporting role in a war without end while providing a temporary refuge for something like two million Syrian refugees, some 67,000 of whom are now begging on street corners in Istanbul.

Erdogan has also exercised extremely poor judgment in not attempting to mitigate his government’s jailing of journalists, which has given him bad press. His gaining control over one-third of the media has also raised concerns among critics. Direct intervention by the government to control what is reported as well as harass opponents has made many independent journalists overly cautious regarding what they write.

Then there is Erdogan’s insistence on grandiose development projects, to include Gezi Park near Taksim Square in Istanbul. Demonstrations and days of rioting followed after the prime minister personally unleashed the police on the largely peaceful protesters. He also banned social media and called the demonstrators and the journalists covering the event terrorists.

Likewise Erdogan’s politicization of Islam might either reflect profound feelings or serve as a bone to throw to his core of religious supporters. Be that as it may, his beneficence has helped create a new self-consciously Muslim entrepreneurial class that has challenged the secularist dominance in many parts of the economy. This displacement of the country’s former secular elite helped fuel the class and cultural conflict evident during last summer’s riots.

There are now Turkish resorts, hotels, housing estates, and restaurants that cater to the “religious.” The comportment of women is particularly scrutinized. Erdogan’s lifting of the ban on the wearing of headscarves in schools and state offices has resulted in a proliferation of the attire, far beyond what might have been imagined in the old Kemalist Turkey. Billboard ads featuring female models have regularly been vandalized and are sometimes banned by government officials for failing to meet “local standards.” But at the same time, many Turks are cool to more rigorous religious adherence with only 12 percent of the population favoring Sharia law.

The Turkish government already has a big role to play in religion, as it pays for the greatly increased number of religious schools in line with Erdogan’s boast that “we are going to raise religious generations.” Government also regulates the approximately 100,000 existing mosques. During Friday prayers, all 100,000 imams read from the same script, which is provided by a bureaucrat at the Ministry of Islamic Affairs. Erdogan plans to build the world’s biggest mosque in Istanbul, even though existing mosques are not used to capacity.

The crux of any argument against Erdogan should be his demonstrably illegal acts. Domestically that would include his corruption and interference in the judicial process. There is little doubt that Erdogan presides over a regime that is awash with corruption. Telephone call recordings reveal that the prime minister personally solicited “donations” from leading businessmen, that his son made tens of millions by illegally trading gold for oil with Iran, and that numerous Justice and Development Party (AKP) apparatchiks have been in on the take from a pool of money managed by the prime minister. Three cabinet ministers were forced to resign when the recordings were made public.

Erdogan has interfered in the judicial process by staging the show trial of senior military officers, and his mass reassignments and arrests of police and prosecutors were undeniably meant to protect himself and his accomplices. He has set up a parliamentary commission to independently investigate the corruption charges, but it has by design gone nowhere. If Erdogan is elected president next week he will have legal immunity and investigations initiated against him will be nullified. In addition, next year the Presidency of the Constitutional Court that presides over government functions will be open and Erdogan will be well placed to fill the position with an ally.

Erdogan has acted criminally in his foreign policy as well. A recorded conversation reveals that the prime minister and his intelligence chief Hakan Fidan considered staging a false flag attack against Turkish targets to justify invading Syria. That would not only be a crime against Turkish law but would also almost certainly qualify as a war crime. There have also been allegations that Turkey has been arming and arranging the movement of the Syrian insurgent al-Qaeda affiliated group Jabhat al-Nusra, including the inadvertent exposure of a clandestine shipment of missiles in January. Turkey only recently declared al-Nusra to be “terrorist.”

Erdogan has claimed that there is a “judicial coup” against him linked to the followers of exiled former ally Fethullah Gulen, a conspiracy which he has called in his usual colorful fashion both a “parallel state” and “blood sucking vampires.” But, apart from numerous arrests, the reassignments of police officers and prosecutors and an ongoing investigation, no evidence has been actually produced to suggest that there is anything approaching a large-scale coordinated effort to discredit or remove him. The Gulenist movement, also referred to as Hizmet, was recently placed on the intelligence list of subversive organizations to enable the government to move against it more aggressively.

But the lack of a demonstrable conspiracy does not necessarily mean that Erdogan errs when he claims to have powerful enemies. He is deeply disliked by many Turks who describe themselves as secular or Kemalists, or who prefer their Islam in a liberal form. Many inside and outside the government would like to see Erdogan gone and it would not be surprising to discover a common interest among opponents to do what they can to attack him.

Erdogan’s maneuvers might also be considered in the context of Turkey’s so-called “Deep State”, which consisted of clandestine mafia-like groups that have operated behind the scenes since the 1950s. The Deep State was made up largely of government officials, many retired but some in active service, who exercised a great deal of influence over government policies from backstage benefitting directly from the country’s persistent corruption.

Erdogan’s 11 years in power have enabled him to become the new owner of the Deep State by muzzling the military and bringing the intelligence service under his direct control. He has also benefited from increased resources, enabling his patronage of supporters to surge dramatically. Phone recordings detail how Erdogan extorts “tithes” from businesses and the wealthy in return for promises of no government harassment. The authorities recently punished Turkey’s largest company Koc Holdings by arranging a tax audit in response to Koc being perceived as anti-Erdogan after it made available its Divan Hotel to shelter protesters who were being gassed and beaten by police at the Gezi Park demonstration. Smaller companies fall in line for fear of losing government patronage and access to tenders.

For those without money, Erdogan seeks loyalty and political support. At one private university I visited that is regarded as anti-Erdogan, a large government cargo helicopter hovers overhead for a couple of hours every day, drowning out conversation. The police also drop by regularly, citing allegations of disturbances. It is pure harassment of a political opponent.

So the simple answer to the question of what is happening in Turkey is that Prime Minister Erdogan presides over an extremely corrupt administration and behaves in an authoritarian fashion, including interfering with the judiciary, to protect his ability to entrench the rule of himself and his followers. He has also proven himself quite capable of committing war crimes to cover up his foreign policy blunders. Other insinuations may or may not be true, and his alleged desire to introduce an Islamic state is as of now not demonstrated, but the danger is that his accession to an enhanced presidency in the near future, coupled with his unassailable voting bloc in parliament, could well mean that he will be pretty much able to do whatever he wants. Therein lies the danger.

Philip Giraldi, a former CIA officer, is executive director of the Council for the National Interest.