Recep Tayyip Erdoğan was elected in 2003, despite having been banned from holding office, and since then he has taken an increasingly harsh line against his opponents. In the past five years, more than seven hundred people have been arrested. Photograph by Abbas / Magnum

Not long ago, at a resort in the Turkish town of Kızılcahamam, Prime Minister Recep Tayyip Erdoğan stood before a gathering of leaders of the Justice and Development Party to celebrate both his country and himself. Erdoğan, a tall, athletic-looking man of fifty-eight, with a receding hairline and a pale mustache, wore a blue Western suit and no tie. His wife, Emine, wearing a traditional head scarf, looked on from a nearby seat. Erdoğan recalled the milestones in Turkey’s remarkable economic and geopolitical ascent since 2002, and the rise to power of the A.K. Party, as it is known by its Turkish initials. He pointed to the doubling of the gross domestic product; the sweeping transformation of the Turkish state and society; and the leading role that Turkey has come to play in world affairs. “With the A.K. Party, the whole world hears Turkey’s words,” Erdoğan said.

Erdoğan (pronounced er-do-wan) spoke with a vehemence that at times approached anger. When he came to the European Union, an organization that Turkey has aspired to join for forty-nine years, he practically shouted into the microphone. Over the past decade, he has led an ambitious campaign to remake the Turkish state as the Europeans asked him to, overhauling the judicial system and expanding the rights of women and minorities, only to find Turkey still outside the gates. “Look at their state of affairs,” he said of the E.U.’s member states. “They are crumbling! Their currency is in disarray!” He gripped the lectern, jabbing the air with his forefinger. “Turkey is on its feet—no thanks to them but to its own people!” He flashed a sharp, joyless grin suggesting both triumph and resentment. “Actually, we have already met the E.U. criteria. Why haven’t we become a member? you ask. They know very well why we haven’t been accepted, and we also know. . . . It doesn’t matter anyway.” Erdoğan was referring to the widespread belief among Turks that the E.U. has rebuffed Turkey because its population, of seventy-four million, is overwhelmingly Muslim.

Erdoğan carried on, mixing his paeans with bitter allusions to enemies and slights. The starting point of his speech was the state of affairs he inherited nine years ago, when Turkey was in an acute economic crisis and under the rule of an entrenched secular élite. There was also a deeply personal subtext. As every Turk knows, Erdoğan was imprisoned, in 1999, for his Islamist leanings. Now, with Turkey’s economy booming, and the opposition in disarray, the need for the Old Guard had receded, he suggested—and so had the need for dissent. “Dear friends, to be one, to be together, to walk together toward the same future is the biggest strength of our people,” he said. “For this reason, the first priority should be to eliminate those who do not want Turkey to grow, develop, and advance. Everyone should be at ease—we will not let anyone disturb this harmony.”

When Erdoğan and his comrades in the A.K. Party came to power, there were widespread concerns that, as ardent Islamists, they were intent on foisting a religious regime on secular Turkey. Erdoğan, for his part, feared the resistance of what is commonly referred to as derin devlet, the “deep state.” The deep state is a presumed clandestine network of military officers and their civilian allies who, for decades, suppressed and sometimes murdered dissidents, Communists, reporters, Islamists, Christian missionaries, and members of minority groups—anyone thought to pose a threat to the secular order, established in 1923 by Mustafa Kemal, or Atatürk. The deep state, historians say, has functioned as a kind of shadow government, disseminating propaganda to whip up public fear or destabilizing civilian governments not to its liking.

Friends and colleagues say Erdoğan worried that the deep state would never allow him to govern. But, to the surprise of many, he has pulled Turkey closer to the West, opening up the economy and becoming a crucial go-between for the West with Palestine, Iran, and Syria. He has called on the Assad government, in Damascus, to step down, and has tried to help build a bridge between the West and Tehran in the current nuclear standoff. In the eyes of American and European leaders, Erdoğan has fashioned Turkey into an indispensable Islamic democracy, offering a potential example for Egypt, Tunisia, and Syria.

Erdoğan has even dared to surprise his countrymen by reassessing painful chapters in Turkish history. In November, he told an audience of A.K. Party faithful about the massacre, in the nineteen-thirties, of more than thirteen thousand Alevis, members of a Shiite sect. “I am apologizing,” Erdoğan said, at one point holding up a sheaf of presumably damning documents. The moment encapsulated his attempt to force Turkey to confront its horrific record of persecuting its ethnic and religious minorities, including Kurds, Greeks, and Armenians, more than a million and a half of whom were massacred in the early twentieth century.

But Erdoğan’s rule has another, darker side, which the West seems intent on ignoring: an increasingly harsh campaign to crush domestic opposition. In the past five years, more than seven hundred people have been arrested, including generals, admirals, members of parliament, newspaper editors and other journalists, owners of television networks, directors of charitable organizations, and university officials. Some fifteen per cent of the active admirals and generals in the Turkish armed forces are now on trial for conspiring to overthrow the government.

The American response to this intensifying repression has been tepid. President Barack Obama has developed a close relationship with Erdoğan, whom he regards as a dynamic and democratically minded leader. A White House official told me that Obama has regularly voiced his concerns about the treatment of religious and ethnic minorities. On the rare occasion that an American official has made his criticisms public, Erdoğan has easily dismissed them. Last year, the American Ambassador, Frank Ricciardone, raised the issue of detained journalists. Erdoğan mocked Ricciardone, a veteran diplomat and a Turkish speaker, as “a rookie ambassador.”

One explanation for American passivity, repeated by a number of Turks, is that Obama is desperate for allies in the Muslim world and is determined to hold on to Erdoğan as a friend in an increasingly combustible region. When I mentioned this to a Western diplomat, he said that Erdoğan had proved to be a positive leader for Turkey. As the diplomat told me, “Turkey is Muslim, prosperous, and democratic. There isn’t another country like that.” And yet some Turks compare Erdoğan’s Turkey less to the democracies of the West than to the Russian and Chinese models, in which free-market economics are championed and domestic dissent is repressed.

The Palace, a café in the working-class Istanbul neighborhood of Kasımpaşa, is on the same noisy street where Tayyip Erdoğan spent his youth. A concrete-block building occupies the spot where Erdoğan’s father, a seaman for a state shipping company, brought the family after migrating, when Erdoğan was a child, from the Black Sea town of Rize. The street is treeless and bordered by cemeteries, where the tombstones are adorned with Ottoman script. When trucks rumble past, they rattle the Palace’s big front window.

When I went into the café not long ago, a group of men were sitting at a table playing cards. There were no women there, and none of the men could recall the last time one had ventured in. “I win!” one of them yelled, slamming his hand on the table. “I win again.”