By Alistair Lyon
BEIRUT (Reuters) - Iran's Mahmoud Ahmadinejad has often surprised his foes, but Friday's parliamentary poll may make him a lame duck for the rest of his presidency, a penalty for defying the Islamic Republic's Supreme Leader.
Vilified in the West for his barbs against America and Israel, his defiance on Iran's nuclear work, and questioning of the Holocaust, the blacksmith's son has long relied on his charismatic appeal to the poor and devout, as well as his links to the elite Revolutionary Guard and Basij religious militia.
Many Iranians underestimated the little-known Ahmadinejad before he defeated political heavyweight Hashemi Rafsanjani for the presidency in 2005 and even later as he accumulated power.
His re-election in 2009, in a vote his reformist opponents said was rigged, ignited an eight-month firestorm of street protests - a failed foretaste of last year's Arab uprisings.
Ahmadinejad prevailed thanks to unwavering support from Supreme Leader Ayatollah Ali Khamenei, who abandoned his role as lofty arbitrator to fight for the president in a struggle that exposed gaping divisions in the religious and political elite.
But Ahmadinejad seemed only hungrier for power and challenged the authority of Khamenei himself, sacking an intelligence minister last year and then sulking at home for 10 days after the Supreme Leader reinstated the man.
Ultimate power, however, remains with Khamenei.
"Iran has become a one-party system: the party of Khamenei," said Karim Sadjadpour, an Iran analyst at the Carnegie Endowment. "The most important qualification for aspiring members of parliament is obsequiousness to the Supreme Leader."
Ahmadinejad may pay the price for failing to conform to this rule in Friday's election expected to erode his support in parliament, which has summoned him for an unprecedented grilling next month, mainly over his handling of the economy.
DIVIDE AND RULE
"Khamenei likes to divide and rule," Sadjadpour said. "For that reason he may see it in his interests to weaken Ahmadinejad's faction but keep it on life support."
Western sanctions aimed at forcing Iran to make nuclear concessions have started to hurt energy and food imports, but many Iranians blame Ahmadinejad's policies for soaring prices.
They say his cuts in food and fuel subsidies, replaced with direct monthly stipends of around $38 per person, have fuelled inflation, officially running at around 20 percent, although some economists say it is more like 50 percent.
Ahmadinejad's government has been tainted by a fraud alleged to have diverted $2.6 billion of state funds. Dozens have been arrested over the scandal, which was disclosed with Khamenei's approval. The president denies any government wrongdoing.
"I suspect Ahmadinejad will lose in the elections, but of course the term is meaningless," said Ali Ansari, professor of Iranian history at Scotland's St Andrews University.
"I can't see many people voting and in any case the competition is limited to Ahmadinejad and Khamanei candidates," he said. "Given that the Revolutionary Guard want to take more seats, this will signify greater strength for Khamenei inasmuch as these candidates are currently identifying with the Leader."
With reformists mostly sidelined and opposition leaders Mirhossein Mousavi and Mehdi Karoubi under house arrest, the election will pit hard-line factions against each other, all proclaiming loyalty to Iran's Islamic revolutionary ideals.
But Ahmadinejad's inner circle, especially his chief of staff Rahim Mashaie, have angered Khamenei and other senior Shi'ite clerics for promoting a "deviant current" that they see as threatening to those principles and to their own dominance.
Khamenei's backers accuse Ahmadinejad's camp of pursuing an "Iranian" school of Islam, viewed as an inappropriate mix of religion and nationalism. The president berates his rivals for insulting him and has threatened them with jail.
"The clerical elite will not back anyone that it perceives to be inimical to its interests," said independent analyst Mohammed Shakeel. "However, the more the president is marginalized, the more he appears to relish the challenge.
"His own austere lifestyle and his attempts to portray himself as the champion of the poor provide him with a strong counterbalance with which to see through the end of his term."
Ahmadinejad, a small man who dresses informally, plays on his modest origins to connect with rural voters and those who have moved to cities, as his own family did after he was born in the farming village of Aradan, southeast of Tehran.
The 56-year-old president may have hoped to secure the election of a protege to succeed him in 2013, but that would require a revival of his drooping political fortunes.
"It seems the Supreme Leader is dissociating himself from Ahmadinejad ahead of the presidential election next year, when a candidate more amenable to the hard-line conservatives is likely to triumph," said Shakeel.
Ahmadinejad, an engineer and former Revolutionary Guard officer, has upset predictions before. A political unknown before becoming mayor of Tehran in 2003, he defeated Rafsanjani, a powerful former president, in the 2005 presidential vote.
After the tumult of his 2009 re-election, Khamenei praised Ahmadinejad as "courageous, wise and hard-working", while advising him to listen to his critics as well.
By October 2011, the president had so annoyed the Supreme Leader that the latter floated a proposal to change Iran's constitution to do away with a directly elected presidency altogether, an idea Ahmadinejad briskly dismissed as "academic".
Carnegie's Sadjadpour said the president's record of insubordination and relentless self-aggrandizement had alarmed even his former allies in the conservative establishment.
"Ahmadinejad has shown a unique ability to lose friends and alienate people," he said.
(Editing by Philippa Fletcher)
Corrects garbled word in second-last paragraph.