* Erdogan sees graft scandal as bid to unseat him
* Sees himself fighting illegal "parallel state"
* Battle risks undermining years of reforms
By Samia Nakhoul and Nick Tattersall
ANKARA, March 5 (Reuters) - Before cheering crowds, he dons the mantle of tragic hero, comparing his enemies to leeches, reciting a poem that once saw him jailed for sedition and invoking the memory of his political hero, toppled and hanged by the generals.
Turkish leader Tayyip Erdogan, shaken by a graft scandal he says is concocted by a former ally, is fighting to secure his political future in the run up to March polls. But more than that, he sees at stake the legacy of an 11-year drive to reshape Turkey, breaking the hold of a secular, urban elite.
Speaking amid a sea of orange and blue AK Party flags in the western town of Denizli, the Prime Minister moved between anger and sarcasm as he decried a campaign including anonymous online audio-tapes accusing him and members of his family of graft. Its instigators, he said, were worse than leeches.
"Leeches are more virtuous. Leeches suck dirty blood, while they suck clean blood and hold sessions cursing me, my wife, my children, my administration," he boomed, referring to followers of estranged ally, U.S. based cleric Fethullah Gulen.
The Denizli crowd, many bussed in, were core supporters; religiously conservative, most women in headscarves, some in chador, people who have to their mind achieved social justice under Erdogan. Bans on religious attire in state offices have eased and a new business elite has flourished in the Anatolian heartland.
Gulen, whose Hizmet network has strong influence in the police and judiciary, denies involvement in the scandal which began with Dec. 17 raids that spread to sons of ministers and businessmen close to Erdogan. The cleric is generally credited with having helped Erdogan break the political power of a military that had for decades born down on political Islam.
"(Erdogan)...has a messianic complex and Turkey is too small for two messiahs. It is a titanic fight," Hakan Altinay of the Brookings Institution said.
"They will both lose, they will come away from it wounded ... But what is more disturbing is that (Erdogan) is tearing away the social fabric of this country."
Erdogan has hit back by purging the police and judiciary of figures seen as close to Gulen, whose influence is founded on a network of schools, businesses and media groups. He accuses him of building over years a pervasive "parallel state" that he has now turned against the government; something Gulen denies.
Erdogan's achievement with the 2001 founding of the AK Party was to unite a broad spectrum of nationalists and social and economic reformers as well as elements of a conservative religious party pushed from power by the army in 1997.
A child of the hard streets of Istanbul's Kasimpasa district, he provided the strong leadership Turks were seeking after a long period of economic chaos and political drift; but that strength was manifest also in what even allies in time recognised as an intolerance of criticism.
The local polls on March 30 should indicate whether the graft scandal and the backlash against his authoritarian traits are whittling support down to his core constituency - on display in the fervent crowd at Denizli.
Past victories of AK - the acronym spells out "pure" or "clean" - sprang in part from fury with traditional parties over graft and financial failure.
They might also offer some critical insight on how, by what office, he might retain his hold on power in the year ahead.
Yalcin Akdogan, one of Erdogan's top advisers, counters criticism that the government is building a police regime to protect itself, saying the Gulenists had already established one, a charge the cleric has denied.
"(They) made up dossiers on everyone, engineered politics so (they) could reach a point where they could decide the future of the country ... This kind of deep state, intelligence structures with no legitimacy, cannot decide the future of the country," he said. "Of course the government must fight it."
"The conversations of 7,000 people were monitored for years," he says. "We have something similar to an extortion gang, setting up files on everyone, obliterating private life, illegally monitoring everyone's conversations."
Some may not buy Erdogan's arguments. Erdogan has used his power to press legislation, muzzling the media and tightening AK's grip on state institutions. Turkey now ranks second to Russia in the number of European Court of Human Rights judgments brought against it, with 118 to Russia's 119.
Last summer, a bid to redevelop Gezi Park, a small oasis of green space in Istanbul, triggered more than 10 days of mass rallies against what critics see as Erdogan's relentless intrusion into Turks' private and public space, spreading to some 50 cities after riot police used force to repress them.
But while this shook Turkey and exposed Erdogan's inability to cast the diversity of citizens in his pious, conservative mould, it did little or nothing to dent his core support base.
Mocked as he may be on Twitter or Facebook, his hold on Turkey's traditional heartland of Anatolia looks unshakable.
In more than a decade in power, he has spread wealth and involvement, as well as services like healthcare and education, roads and cheap air travel, across Turkey for the first time.
Most Erdogan backers, one European diplomat argued, see the Gulen feud as "not our battle" and view themselves as living in another world - one Erdogan has immeasurably improved.
Erdogan, in a characteristic literary flourish, referred at another election rally to a darker moment in his own career when he was convicted for reciting a poem ruled to be incitement to religiously-motivated hatred.
"The minarets are our bayonets, the domes our helmets, the mosques our barracks and the faithful our army," he said at the rally in Isparta. "I went to prison for reciting this."
For many, corruption is little of a surprise and seen as an almost legitimate quid pro quo for the dramatic rise in their living standards. They will, one European diplomat said, be receptive to the AKP narrative of a multi-layered conspiracy, hatched abroad and using the Gulenists as its foot-soldiers.
"We were in a system quite close to a colonial system, in which the 'white Turk' elites found it normal that people in the countryside were poor and in effective servitude, without the same educational possibilities," the diplomat said.
"He has introduced social mobility. I think there is something profoundly sincere in his mission here."
While enemies portray him as corrupt or as a man with a secret Islamist agenda - something he also denies - few who observe him can miss that sense of mission combined with a dark undertone of tragedy drawn from Turkey's past.
Erdogan repeatedly compares himself with Adnan Menderes, a Turkish prime minister overthrown by the military in 1960 and hanged along with two ministers a year later.
Menderes eased curbs on religion, much as Erdogan has done, allowing thousands of mosques to reopen, opened new religious schools and legalised the call to prayer in Arabic. He also, like Erdogan, was accused of increasingly authoritarian rule and stifling press freedoms.
"Their sedition brought the late Menderes and his two friends to the noose. The CHP was behind this event," Erdogan said, naming the Republican People's Party which today is the main opposition.
"They are now doing to us what they did to Menderes," he told a rally in the southwestern city of Mugla, near Menderes' hometown of Kocarli. "They are coming at us with ugly slander, corruption slander, with lewd slander...Whatever role the CHP took on back then, it is assuming that same role today."
Gulen is widely believed, through his power in police and judiciary, to have helped drive from politics the military that toppled Menderes and three other prime ministers in the decades ahead. Hundreds of generals are in jail convicted of plotting coups. The top command is now hand-picked and loyal to Erdogan.
An army coup seems a very distant peril. The CHP, the party forged by secular state founder Mustafa Kemal Ataturk, appears also too weak to match the AKP machine at the polls. Gulen has made it clear he has no intention to form a political party.
"There is no political force to pick up the ingredients and cook a better meal, the opposition has no sense of direction," said Altinay of Brookings.
Most of the electoral map is AK Party orange and that looks set to remain true after the municipal elections, although the race for Istanbul and Ankara could be close. Losing either would dent Erdogan's aura of invincibility and, most of all, raise doubt over him mustering the 50 percent he would need to win the popular vote in a presidential election in the summer.
AK Party rules forbid Erdogan serving a fourth term as premier after 2015 general elections.
Initially, he intended to move on into a Presidency with enhanced executive powers. When that plan failed to rally enough support, his aides argued the President's role in any case had powers seldom used, such as chairing Cabinet meetings. Using those powers would be all the more justified now that direct elections have been introduced for the first time.
The risk for Erdogan, whose party won 49.8 percent in the 2011 general election, is that he may not win the 50 percent vote necessary for an outright victory at a presidential election. His disparate and weak opponents might then unite around a single challenger in a second round to thwart him.
"With his strategy of polarisation I don't see how he can get the 50 percent plus one vote," said the European diplomat. "I don't see anyone knocking him out in the first round, but I don't see how he could win in the second round."
If AK support flagged at the local polls, he might instead ask the party to change its rules and allow him to run for a fourth term as prime minister. While this would look like a real change in tune, the European diplomat suggested Erdogan could pull off such a shift without much resistance.
"It's not impossible for him to argue instead that you need a strong PM to fight the parallel state."
While even his enemies are hesitant to predict Erdogan's imminent demise, they argue the slide has begun.
"The prime minister has faced lesser but similar difficulties in the past. He has survived, in fact he has always come out on top," said Faruk Logoglu, vice chairman of the CHP and a former ambassador to Washington. "But I think this time the problem is too big even for him to handle."
(Additional reporting by Orhan Coskun, Ayla Jean Yackley, Can Sezer, Ece Toksabay and Ayse Sarioglu; Created by Samia Nakhoul; editing by Ralph Boulton)