Turkey's ruling AK Party re-elected Prime Minister Ahmet Davutoglu as its chairman at a congress on Saturday where the longest shadow was cast by a politician who, officially at least, is no longer a member: President Tayyip Erdogan.
Although Erdogan did not appear in person - as president he is supposed to refrain from party politics - many of his loyalists were named to executive committees, something Davutoglu had hoped to avoid, according to some party officials.
Turkey's most popular and divisive politician in recent memory, Erdogan faces budding discontent from inside the movement he founded, officials say. His drive to secure an absolute majority for the AKP has pushed it toward a November snap election that could again leave the party in stalemate.
The political uncertainty is worrying NATO allies and investors in Turkey's $800 billion economy. The lira currency TRYTOM=D3 has fallen to a series of record lows.
Davutoglu portrayed Turkey as a country under siege from Kurdish rebels, again fighting troops after breakdown of a ceasefire in July, and leftist radicals at home as well as Islamist fighters across the border in Syria.
"Every kind of effort has been exerted to plunge Turkey into chaos since the June 7 election," he said.
"Suddenly, the PKK, the DHKP-C, the Islamic State, with their foreign support, pressed the button to destroy all of the accomplishments of the AK Party's 12, 13 years in power. While they are taking action to achieve their evil aims, the AK Party cadres are taking action for a new democracy on Nov. 1."
Friction between Erdogan and Davutoglu led to speculation the president would have former transport minister Binali Yildirim challenge Davutoglu for the chairmanship of the centre-right, Islamist-rooted AKP, party officials said.
But Davutoglu stood for the leadership unopposed. "He seems to have scared Davutoglu into toeing his line by raising the specter of his man Binali Yildirim contesting the leadership," said Halil Karaveli, managing editor of policy journal The Turkey Analyst, a policy journal. In a recent meeting to smooth out differences, Davutoglu agreed to allow Erdogan loyalists in executive party positions, a senior party member said. Erdogan's son-in-law, as well as Yildirim and his former lawyer were all named to executive committees on Saturday, while Davutoglu's allies were conspicuously absent.
Party officials say that among differences within the ranks there is argument over Davutoglu's efforts to form a coalition after the AKP lost its absolute majority at a June election. Erdogan himself is not a leader easily given to compromise and is accused by critics of growing authoritarianism.
After the AKP failed to find a junior coalition partner, Davutoglu was forced to form a temporary cabinet.
Erdogan's hope is that the AKP can win enough votes to change the constitution and create a more powerful presidency for him. Erdogan had surrendered the prime minister's position he had used to develop a strong grip on the country over 10 years and moved to the presidency confident he could transform it from a largely symbolic post to a powerful executive position. In this he seems - for now - to have miscalculated.
As the congress began in a packed and sweltering arena in Ankara on Saturday, signs of Erdogan's popularity were everywhere, with some attendees wearing headbands and red scarves emblazoned with his image.
A video showed him addressing huge crowds at rallies, meeting with world leaders, such as Russia's Vladimir Putin and British Prime Minister David Cameron, and inspecting building sites in an orange hard hat. That was followed, later, by a similar video featuring Davutoglu.
Though nominally above party politics, party officials say Erdogan still exerts enormous influence over the AKP and will make this felt as members of the party's powerful committees are chosen.
"Some of Erdogan's more drastic authoritarian moves are likely the result of political survival instincts," said Erik Meyersson, an assistant professor at the Stockholm School of Economics.
"In practice, this would mean retaining control over leadership of the party - somewhat peculiar given that he's not the official head of the party any more - and appointing lieutenants personally loyal to himself."
One senior AKP official said this would annoy some factions, but that there was little they could do about it. "Nobody can risk a massive breakup, and everyone is aware of this sensitivity," the official said.
Suleyman Ozeren of the Global Strategic Research Centre agreed that feathers would be ruffled, "but it must also be accepted that the one who controls the party is President Erdogan".