But unprecedented protests and riots may now set limits to the power of a prime minister widely seen as victim of the same uncompromising and emotional manner that has helped him to three successive election victories. They may also bury his hopes of assuming a new more powerful executive presidency next year.



"There are deputies and officials in the party who are unhappy about recent developments," said a source close to the AKP party Erdogan led to power in 2002, crushing established parties mired in accusations of incompetence and corruption.



"This is an unprecedented situation for Erdogan. Some people in the AKP think that his policies have to soften, but they remain loyal to party discipline and to Erdogan himself."



Supporters on Twitter, echoing the emotional drama of recent days, declare they would not abandon Erdogan to the same fate as his two political heroes, a prime minister hanged after a 1960 military coup and a president some say was poisoned.



Police use of tear gas and water cannon against a small demonstration over an Istanbul building project on Friday ignited protests across Turkey, drawing in social groups including professionals, unionists and a large proportion of young people who had known no other prime minister.



Erdogan only swelled their ranks by dismissing protesters as "looters" and promising with familiar candour: "If this is about holding meetings, if this is a social movement, where they gather 20,000, I will get up and gather 200,000 people. Where they gather 100,000, I will bring together one million."



OLIVE BRANCH



The more measured comments of President Abdullah Gul and deputy prime minister Bulent Arinc, AKP cofounders along with Erdogan, seemed to sit ill with Erdogan's bluster.



Gul and Arinc met after Erdogan's departure on a North Africa visit. After the meeting, Arinc offered an olive branch by apologising to demonstrators for police excesses. Erdogan, presumably with the accord of the two, is for now holding his peace.



"Erdogan takes things very personally," said Cengiz Candar, a journalists who has closely followed Erdogan from his days in a small Islamist party and his imprisonment for reciting a poem about religion to his rise to the pinnacle of power.



"He has developed a very authoritarian style."



Erdogan's early reforming zeal brought tangible human rights reforms, including Kurdish minority rights, the opening of European Union entry talks and abolition of a military-dominated National Security Council with broad control of state affairs.



More recently he has been criticised at home and abroad over a wide-ranging coup investigation, heavy pressure on the media and restrictions on alcohol retail that critics attribute to religious motives rather than health concerns.



Those familiar with Erdogan say he does not take well to personal challenges.



Excoriation on the streets and Western criticism over police action, will have been still more galling. Syrian advice to its citizens to avoid travel to neighbouring Turkey "for their own safety" would only have added an extra twist to the screw.



Erdogan's mistake may have been to fundamentally misjudge the nature of the protests as they developed last weekend.



In a speech, he compared them to past Istanbul "Republic" protests organised by militant secularists accusing Erdogan of trying to replace Turkey's secular republic with an Islamist order. At one rally, banners urged army intervention against Erdogan. That meeting was later cited in treason trials as part of a plot to destabilise Turkey and trigger a military coup.



Erdogan denies accusations of secret Islamist ambitions.



Perhaps Erdogan's greatest service to democracy in Turkey - though some critics view it as a campaign intended only to safeguard his own power - has been the breaking of the power of the military, which toppled four governments in the second half of the 20th century. Hundreds of officers have been jailed after coup trials that have inflicted deep wounds on the military.



The speech held another insight into Erdogan's frame of mind. Tellingly, he also likened Taksim protests to incidents leading up to a 1960 coup against prime minister Adnan Menderes.



"This attitude is...(that) of those who cannot tolerate governments who come to power through elections," he said. "It's the attitude of those who call the people 'blockheads' and 'belly scratchers'."



Erdogan identifies zealously with Menderes, who has gone down in Turkish history as something of a tragic figure.



Menderes ended decades of unchallenged rule by the party of secular state founder Mustafa Kemal Ataturk, the CHP, and introduced liberal reforms; but he later fell prey to the same uncompromising and authoritarian style that won him election.



His career ended on a military gallows in 1961.



Erdogan, underlining his legitimacy as leader, points to the 50 percent vote he received in the last election and his clear majority in parliament. He still has no credible rival, nor is there any significant opposition in parliament.



The "Republic" protests of the past if anything increased his support, especially in the conservative heartland of central Anatolia. But this favour is by no means assured after Taksim.



HEALING WOUNDS



"I don't think Erdogan has the 51 percent any more ... He has 25 percent confirmed that are loyal to him," said Koray Caliskan, associate professor at Bogazici University.



"I was at parliament ... and met many AKP MPs. One of them said 'The prime minister says one thing, while the President says another. We can't speak freely in the Group. There's no democracy. This needs to be discussed but it can't be.'"



The lesson for Erdogan, according to critics and some allies, is that he must take account of the 49 percent who did not vote for him, and those of that number who never will trust him.



Among them are influential parts of business and the middle classes, who may have benefited from AKP economic stewardship that has tripled per capita income, but view his long-term plans and his personality with deep suspicion.



The protests could yet build from the motley gathering of very disparate activists on Taksim Square. What may be emerging is an irreverent civil society garnered, ironically, by Erdogan.



For now, he remains unchallenged leader of the AKP, whatever the fears haunting some parts of the party.



The triumvirate of Erdogan, Gul and Arinc remains intact.



If they were driven apart it would not be by questions of strategy - they are 'old comrades' bonded by years in the political wilderness of political Islam in the 1980s and 1990s. What could conceivably divide them are tactics and personality.



Frictions between Erdogan and Gul, the power axis of the party, have broken into the open on occasion.



When Gul complained about the long detention of suspects in a coup plot investigation, Erdogan responded in minutes with a public rebuke for the president. When Gul met officials of Kurdish party the BDP last year over a flare-up in the Kurdish rebellion in the southeast, he was again publicly slapped down.



Everything here would appear to hinge on Erdogan's continued ability to patch up spats with Gul and maintain mutual respect, however pressure mounts.



"Mr President and Mr Prime Minister can have different characters, styles, they can have different views on specific issues, but to reflect that as a general difference of views is incorrect. There is no problem between Mr President and Mr Prime Minister," said AKP MP Professor Mustafa Sentop.



Erdogan was believed to be planning to stand for a powerful new executive presidency next year, perhaps with Gul moving to a subordinate prime minister's role. But moves to create that presidency appear to have foundered in parliament.



This would leave Erdogan either to stand for the non-executive presidency in 2014, with Gul heading to the prime ministry as the guiding force, or to serve out what under the constitution would be a final term as premier ending in 2015.



Erdogan has already set his stamp on Turkish history as the most significant leader since Ataturk; but he will have to show consummate skill to establish himself yet as the man who united a country still uneasy in its skin 90 years after Ataturk ended an Asian theocracy and imposed a western-style secular state.