A demonstrator waves a flag as he sits on a monument during a protest against Turkey's Prime Minister Tayyip Erdogan and his ruling AKP in central Ankara, 2013. (Umit Bektas / Courtesy Reuters)

When Recep Tayyip Erdogan was mayor of Istanbul in the mid-1990s, he did what successful big city mayors do -- he made life a little easier for the millions of residents of his beautiful, maddening megalopolis. Erdogan cleaned up the garbage in the streets, unknotted traffic, and literally cleared the air by introducing environmentally friendlier public transportation. Always one for grand ambitions, during his tenure at City Hall the future prime minister made a now often repeated statement to a journalist from the daily Milliyet, “Democracy,” he declared, “is like a tram. You ride it until you arrive at your destination, then you step off.”

These stories go a long way toward explaining the demonstrations against Turkey’s prime minister over the past several days. Erdogan, who hails from a rough-and-tumble neighborhood of Istanbul, has both an innate sense of what makes average Turks tick and an oddly instrumental view of democracy. He never indicated the “destination” toward which he thought Turkey's democracy should be headed. But 15 years later, many Turks have drawn the conclusion that Erdogan had always intended to step off the tram as soon he had accumulated unrivaled power.

The prime minister’s party, Justice and Development (AKP), was founded in August 2001 after young reformists broke from the old guard of Turkey’s Islamist movement. Even then, Erdogan was a first among equals, but he had important associates, especially Abdullah Gul, who now occupies the presidential palace and remains officially above politics. Yet, in time, Erdogan became the party and the party became him. Not that Turkish voters seemed to mind: the AKP has had a majority in parliament since November 2002.

Trees were only a proximate cause of the first full-fledged political crisis of Erdogan’s remarkable decade long run. For many of the people who turned out to protest over the last four days, Erdogan wore out his welcome from the very start. Supporters of the Republican People’s Party (CHP), which represents a peevish, reckless, and visionless group of Kemalist elites and alleged social democrats, oppose the AKP on principle. There were also reports of Leftists and “anti-capitalist Muslims” joining the fray. A variety of small, less-influential political parties turned up to wave flags in Taksim Square. Yet the anger went beyond the typically narrow interests of Turkey’s party politics. The demonstrators were not “marginal” as Erdogan asserted, but rather profoundly frustrated because they have been marginalized.

The prime minister has responded to the demonstrations with anger, at one point threatening to bring millions of supporters into the streets. Erdogan’s style may be lamentable, but he was right to point out his millions of supporters. When he and the AKP scored an unprecedented 47 percent of the popular vote in the 2007 elections, the prime minister enjoyed the backing of a broad section of Turkish society -- pious Muslims, Kurds, liberals, big business, and average Turks whose bank accounts grew during Erdogan’s first term. With a majority in the parliament and a vast reservoir of public support, the prime minister plowed ahead with plans to transform the country politically and economically, dismissing criticism with a high-hand and arresting and silencing peaceful political opponents. This shattered his coalition as liberals fled, Kurds drifted away, and big business cowered in fear of a powerful government that had demonstrated its willingness to punish firms that failed to heel to the prime minister and his party.

Even though Erdogan has resorted to intimidation and other authoritarian tactics, he keeps racking up impressive electoral victories. In June 2011, voters returned the prime minister and his party to power with 49.95 percent of the vote. Even today, as the tear gas continues to fly, there is no question that Erdogan would win an election. It is hard to see how the moribund opposition can capitalize on Erdogan’s missteps, and although AKP supporters may be watching developments with consternation, they are not ditching their membership cards. This is because, consistent with Erdogan’s record as mayor of Istanbul, he has done many things as prime minister to make the lives of Turks appreciably better. Advances in transportation, health care, and economic opportunity are profoundly important to a growing middle class who returns the favor in the form of votes.

Still, Turkey is decidedly split. Erdogan governs one half the country -- his supporters -- and intimidates the other. His political lineage and personal background have instilled within him a certain amount of paranoia. Turkey’s Islamists, no matter how powerful they become, are always on the lookout for the next coup or round of repression. (In 1998, for example, Erdogan was jailed for reciting a poem that was allegedly a call to holy war against the Turkish state even though the author is one of the most important theorists in Turkish nationalist pantheon.) For the rising new political and business class that Erdogan represents, correcting the past wrongs of the Kemalist elite -- which discriminated and repressed the two bogeymen of the Turkish politics, Kurds and Islamists -- has been a priority. They have worked to accomplish it through both democratic and (more often recently) non-democratic means. The problem for Erdogan is that, despite his best efforts, the tram that he referred to when he was mayor of Istanbul stopped in Taksim Square, where a lot of Turks are signaling they will no longer tolerate his authoritarian turn.