ANKARA Prime Minister Tayyip Erdogan has won three general elections, weathered summer riots, subdued a meddling army and changed Turkey like few leaders before him in a decade in power.
But a rift with an enigmatic U.S.-based Islamic preacher, whose quiet influence in the police, secret services and judiciary looms large over the Turkish state, threatens to shake his hold on power ahead of elections next year.
The powerful network of Fethullah Gulen, who leads a worldwide Islamic movement from a forested compound in the United States, had helped Erdogan's Islamist-rooted AK Party win a growing share of the vote in three successive elections.
"This is a nasty and bloody divorce," wrote Kadri Gursel, a columnist critical of the government but who writes for the broadly pro-Erdogan Milliyet daily.
Summer protests and riots in central Istanbul underlined growing concern especially among secularists about Erdogan's increasingly authoritarian style of government.
Recent months have also brought into the open conflicts with Gulen's "Hizmet" (Service) movement. Chief focus in recent weeks has been a government plan to abolish private "prep" schools, many financed and run by Gulen, on the grounds they give unfair advantage to wealthy parents.
Gulen has set up schools across Africa, the Middle East, the United States and Asia. They are a key source of income but also a powerful instrument of influence, especially in Turkey, creating a network of elite contacts and personal loyalties.
The Hizmet movement is widely seen as having helped break the grip of the army, self-appointed guardians of secularism, over Turkish politics, arguably Erdogan's greatest achievement, through its influence in the judiciary, with hundreds of officers convicted on coup plot charges.
Erdogan has built his own body of wealthy loyalists since he came to power in 2002, largely from the same religiously-minded professional class that revere Gulen, but a rift between the two risks fracturing that support base as polls approach.
When Erdogan visited Washington this year he sent an ally to Pennsylvania to sound out the plans of Gulen, who left Turkey in 1999 after being charged with plotting to establish Islamic law. But the power of Gulen, who was acquitted but has remained in America, lies partly in his enigmatic style.
There have long been ideological differences, many of Gulen's followers seeing him as a more progressive and pro-Western influence on Turkey than Erdogan, whose views on issues from abortion to alcohol consumption have triggered accusations of interference in Turkish private life.
Those tensions have spilled into the open in a power struggle at the heart of the ruling party that could shape Turkey's political landscape for the next decade.
Hizmet's power lies more in its influence within the AK Party bureaucracy than any ability to sway voters at the ballot box. With most of the electoral map AK Party orange, there is little sense it could unseat Erdogan even if it wanted.
But it could act as a check on what it might see as Erdogan's excesses, throwing its weight for example behind the opposition in March local elections, with the commercial capital and largest city Istanbul the key prize.
TEST OF STRENGTH
An AK Party loss in Istanbul, which experts and pollsters see as broadly unlikely but do not rule out, would be a massive blow for Erdogan, who served as mayor in the city in the 1990s. Even a reduced margin of victory would dent his standing.
Erdogan's eyes may also be on August presidential elections which he is expected to contest and 2015 parliamentary polls.
"Just ahead of the local elections, to wage such a serious battle with the Hizmet movement gives an opportunity to test its electoral strength," said Ahmet Sik, a journalist detained for a year over his book on Gulen's life and influence.
"Erdogan will be able to see exactly what he is up against," Sik told Reuters.
Mustafa Sarigul, the popular mayor of Istanbul's upscale Sisli district for almost 14 years, is expected to stand for the main opposition Republican People's Party (CHP) in the Istanbul mayoral race.
Born in eastern Turkey, he is not seen as typical of a CHP breed viewed by many AKP supporters as staunchly secularist, elitist and disconnected from the religiously conservative Anatolian heartlands where Erdogan draws core support.
A meeting in Washington this month between CHP leader Kemal Kilicdaroglu and representatives of an association known to be close to Gulen fuelled speculation of a closer alignment and even talk of Hizmet support for Sarigul's Istanbul bid.
The AK Party has nominated incumbent Kadir Topbas, who has run the city of 12 million people for almost a decade, as its candidate for Istanbul, the heart of weeks of fierce anti-government demonstrations over the summer.
Local elections in 2009 saw a fairly close race with Topbas winning just over 3 million of 8.8 million votes while Kilicdaroglu, then the mayoral candidate, took 2.6 million.
Ozer Sancar, head of MetroPoll Strategic and Social Research Center, estimates Hizmet members account for 3-5 percent of voters but their influence could go much deeper.
"Our research consistently shows that between 28 to 33 percent of our society is sympathetic towards Gulen. To think that someone with that level of admiration will not have much influence would be wrong," Sancar told Reuters.
"In Istanbul, the CHP's votes are not that far off AKP and that little 5 percent that Gulenists have could swing the outcome."
Tensions between Erdogan and Gulen have come to a head before, notably in February 2012, when prosecutors sought to detain Hakan Fidan, a former adviser to Erdogan whom he later made his intelligence chief.
Erdogan blocked the investigation, seen by some of his supporters as driven by a Gulenist-influenced judiciary, in what many commentators saw as a defining moment in his relations with the Hizmet movement.
"I believe the cornerstone for the breakup of the alliance between the Gulen movement and the government was the National Intelligence Agency crisis," wrote Vatan columnist Rusen Cakir, describing the current situation as a "pitched battle".
It is being waged in public, through the media.
In a series of front page stories, pro-Gulen daily Zaman has repeatedly denounced the government's plans to abolish prep schools, while another pro-Hizmet paper, Taraf, has escalated the tensions by publishing documents from 2004 purporting to show a government plan to eliminate the movement.
Erdogan has accused the Taraf reporter of treason and shows little sign of backing down, gearing up for the local elections with a tour of the country, announcing his mayoral candidates for key cities at gatherings more akin to campaign rallies.
Polls show little or no fall in Erdogan's support since the anti-government protests of the summer, when tens of thousands took to the streets. Despite the feud with Gulen, his loyalists are unswayed.
"Many people from the Hizmet are part of the AK Party ... I don't see an issue here. The problems between the AK Party and the Movement will be solved," said a senior party official.
"Istanbul is of critical importance for us. It is the AK Party's castle. We will conquer it again."