By vilifying young protesters as extremists, looters and terrorists and seeking to crush their challenge to his 10-year rule, Turkish Prime Minister Recep Tayyip Erdogan is gambling with his political future and his country's relations with Europe, say analysts.
For years, Turkey's secular middle class and its devout Muslim Premier have eyed each other with barely-disguised suspicion. Now the animosity is in the open, as police battle with educated urban youngsters in Istanbul and other cities.
Four people, including a policeman, have died, about 5000 people have been injured and nearly a thousand have been arrested.
The spark has been Erdogan's plan to develop Taksim Square, a symbol of the republic established by revered secularist Mustafa Kemal Ataturk.
Opponents say the scheme is one more step in a salami-slicing of the secular state. They see Erdogan as driving an Islamist agenda that has already gutted the military - the self-appointed guardians of the secular state - and jailed more than 100 journalists, encouraged the wearing of Islamic headscarves and imposed laws limiting the sale of alcohol.
The unrest has battered Turkey's image as an island of stability in a region of turbulence and radicalism.
Domestically, Erdogan's position remains solid, because of his popularity among conservative rural and urban working-class voters who admire his steadfastness and piety. But the country is now polarised, and anger and doubt about his ego may cloud his ambitions for the presidency, they say.
"His supporters see in him a strong leader who can cope with all the internal and external dark forces who are trying to prevent him from serving the interests of the people he represents," the Ankara director of the German Marshall Fund think-tank, Ozgur Unluhisarciki, told the Herald.
"His opponents see in him a leader getting more authoritarian day by day. Internationally, and especially in the West, he is seen as an authoritarian leader."
Erdogan, 59, draws his legitimacy from the ballot box and his credibility as a reformer in a country of vital strategic interest.
A former Mayor of Istanbul, he has steered the Justice and Development Party to three successive parliamentary election victories. Inflation has been tamed and the economy has boomed, with growth averaging more than 7 per cent per year. He started Turkey's negotiations for membership of the European Union, which now accounts for 40 per cent of exports. EU pressure prompted several measures of democratisation, including the lifting of a media ban on the Kurdish language and giving a partial amnesty to guerrillas.
These difficult steps bolstered Erdogan's insistence that he stood by the secular state and helped transform Turkey into a model for a moderate, stable and prosperous Muslim state.
Things started to sour when the euro crisis distracted the EU and reduced Turkish interest in membership. Free of EU leverage and bolstered by his third election win, Erdogan became more strident and complaints about Islamist abuses have multiplied. Over the last three years, there has been no progress at all in the accession talks.
Then came the Arab Spring, which caused Erdogan's foreign dreams to take flight, predicated on the notion of Turkey as kingpin in a Muslim region stretching from the Balkans to Central Asia - the same expanse as the old Ottoman empire.
Erdogan is a sultan, and "the Sultan has no clothes", former Pentagon official Michael Rubin, who writes books and lectures on Middle East politics, told the Herald by email.
"Many European officials now realise that behind the rhetoric of reform and European Union accession, Erdogan's mentality hasn't changed ... both inside and outside Turkey, people realise he's no democrat."
For now, Brussels' response has been to show vigilance and concern but not rock the boat.
EU Foreign Minister Catherine Ashton called on Erdogan to "find a way forward, based on dialogue, tolerance and mutual respect" and European Commissioner Stefan Fule warned that countries aspiring to the EU club have to reach for "the highest possible democratic standards and practices".
But he also said: "We, on our side, have no intention to give up on Turkey's EU accession."
National politicians and European Parliament legislators have been less restrained, although no mainstream figure has demanded the membership negotiations be scrapped.
Italian Foreign Minister Emma Bonino warned that the protests marked the "first serious test for the durability of democracy in Turkey and its accession to Europe".
"Some people think that Turkey had passed that test thanks to its dynamic economy but much more is needed," she said.
Erdogan is limited by party's rules to three terms as premier, but has indicated he wants to become president next year, under a new constitution that would transform the head of state from figurehead to executive.
But voices of moderation have risen to signal opposition to him. One is that of the 62-year-old current President, Abdullah Gul, who co-founded the AKP and is himself no stranger to accusations of Islamism.
On June 3, after Erdogan had bitterly condemned the protesters, Gul told them their message had been "received" and "democracy does not only mean elections".
"Erdogan has been weakened by this crisis and his rise to the post of president has been compromised ... while Gul has strengthened his democratic image," Radikal, a liberal Turkish daily, said in an editorial.
Said Unluhisarciki: "It is still likely that he [Erdogan] would be elected if he runs for the presidency, though Abdullah Gul's bid for a presidential confirmation cannot be ruled out completely any more. It is now unlikely that Erdogan can change the constitution to introduce a presidential system in Turkey."