ANKARA (Reuters) - He sits in his newly-built thousand-room "White Palace", his plans for a powerful presidency all but ready; but in the very hour that should have seen his final triumph, Tayyip Erdogan's star appears to be waning.
If one sentiment united the country's disparate opposition parties after Sunday's parliamentary election, it was this: a resounding "no" to Erdogan's drive to transform the country's political landscape in search of what he sees as a new Turkey.
The AK Party he founded in 2001 remained by far the biggest party, but for the first time in 13 years, it lost its overall majority, and fell well short of the two-thirds majority it needs to change the constitution. Coalition beckoned for a man not well used to compromise.
Erdogan's ambition and unquestionable authority, which long held together a party embracing liberal reformers, center-right and nationalist elements as well as religious conservatives, now risks pulling it apart.
Western NATO partners have also been disturbed by the possible consequences of political turmoil in an ally bordering Iraq, Syria and Iran.
"These results could be summarized in one sentence: the voters said 'enough' to Erdogan," said Ahmet Insel, a columnist and professor at Istanbul's Galatasaray University.
Erdogan, 61, stepped down after over a decade as prime minister last August to take up a largely figurehead presidency he planned to convert into a powerful executive post.
Stretching the constitution to its limits, he held onto the reins of government, holding cabinet meetings at his palace. It was, he calculated, just a temporary indulgence until a new parliament endorsed his planned new role.
Critics said he paid little heed to his obligation as president to remain above party politics. He addressed up to three rallies a day ahead of the vote, often overshadowing Prime Minister and party leader Ahmet Davutoglu, whom he accused of doing too little to promote the idea of an executive presidency.
"Erdogan's discourse has weakened Davutoglu. No matter what anyone says, Erdogan taking control of the party's election process, and interfering with daily events has caused discomfort in the party and among voters," a senior AKP official said. "Erdogan is the natural leader, no one is denying this, but he should have left the party's work to the party," the official said, asking not to be named for fear of retribution.
Erdogan forged the AKP as Turkey slid into financial crisis in 2001. It won a growing share of the vote in three successive parliamentary elections, during a decade which saw incomes rise sharply and Turkey establish itself as a regional power.
But his growing intolerance of dissent has alienated half the population, leaving Turkey acutely polarized, while the centralization that marks AKP is a cause of increasing concern.
Some in the AKP fear he will blame Sunday's result on Davutoglu, who has tried to build his own influence in the party, and seek revenge, seeking to replace him with a more pliant alternative.
"Erdogan will see these results as a defeat for AKP, and will criticize the party...he always thinks about Davutoglu's alternative," a second senior party official said.
"He never accepts defeat...But it will not be as easy as before for him to do what he pleases in the AKP. There is a group whose respect Davutoglu has won and there is more criticism towards Erdogan in the party than ever before."
In stark contrast to his triumphalist appearances after past elections, he seemed conciliatory in a first brief statement from his office on Monday.
"Our nation's opinion is above everything else," he said.
It would be a brave man who bet against Erdogan, a towering figure of Turkish politics once jailed for sedition, a colorful orator given to inspire supporters with Ottoman poetry and pledges of justice for a conservative religious class he says has been trodden underfoot by decades of secular governments.
He won credit at home and abroad for political and economic reforms largely in his first two terms as premier. The last few years have witnessed an increasingly authoritarian rule, though he has bounced back from mass protests and a corruption scandal.
Etyen Mahcupyan, a former advisor to Davutoglu and co-founder of Istanbul-based think-tank PODEM, predicted Erdogan would weather the setback.
"He looks for legitimacy through votes. Whatever the vote says, he will accept that. His time is not finished," he told Reuters in the run-up to the election.
"The questions for Erdogan will be what kind of party do I want, what kind of party can get 50 percent again."
He faces strong headwinds.
Selahattin Demirtas, the charismatic leader of the pro-Kurdish Peoples' Democratic Party (HDP), is the one opposition politician who demonstrates anything resembling Erdogan's charisma. He appears to be succeeding in capturing the imagination of the left, taking his party beyond its roots in Kurdish nationalism and propelling it into parliament for the first time at the expense of the AKP.
Turkey's economy, long a pillar of the AKP's electoral successes, is also vulnerable, slowing after years of stellar growth, while the growing threat from jihadism in neighboring Syria and Iraq comes at a time when its relations with both Western and regional partners are strained.
For Mahcupyan, the AKP will need to look to a new generation of Islamic conservatives, pious but more democratically-minded and comfortable with liberal values, if it is to claw back support.
"At the end of the day Tayyip Erdogan is a paternalistic person, he is not a democrat. But who is a democrat in Turkish politics? No-one," Mahcupyan said.
"Erdogan is very influential, but up to a point. From that point on, he has to adapt, he has to conform, he has to learn."
The learning could begin soon.
If the AK Party is forced to, or able to, form a coalition, the junior partner may well refuse the long trek to the presidential palace, built at a cost of some $500 million, to hold cabinet meetings under Erdogan. The president, however, is not one to sit in lonely splendor and await events.
Additional reporting by Gulsen Solaker, Jonny Hogg and Tuvan Gumrukcu in Ankara; editing by Ralph Boulton; Writing by Nick Tattersall