Iran's president hardly seemed like a fading political force at a security summit in Beijing last week. Leaders from China and Russia carved out time to hold private talks with Mahmoud Ahmadinejad and gave him center stage to unleash his pet theories about the unraveling of Western power.
But Ahmadinejad always seems to catch a second wind on the road. It's at home where his political wounds are most visible and his expiration date is already factored into high-stakes calculations.
The one-time favored son of Iran's theocracy _ its flame-throwing populist in a common man's wind breaker or bureaucrat's off-the-rack suit _ is now limping into his last year in office sharply weakened and in the unexpected position as an outcast among hard-liners.
"It may be hard to believe for those who just pay attention to the theatrics of Iranian politics, but Ahmadinejad has emerged _ somewhat by process of elimination _ as something of a moderate in relation to the archconservatives in the ruling system," said Salman Shaikh, director of The Brookings Doha Center in Qatar.
"The reformers and opposition have been crushed or silenced," he added. "That leaves Ahmadinejad and his big political ego."`
Ahmadinejad lost a power struggle last year with the ruling system, which had helped him rise from the relative obscurity of Tehran's city hall seven years ago and stood by his side in 2009 amid the mass chaos from his disputed re-election.
Yet he still has some political ammunition in reserve. How he uses it will set the tone for Iran's internal policymaking as it struggles with big questions such as: how far to bend in the nuclear standoff with the West, how to counter deepening sanctions and what to do with the combative and ambitious Ahmadinejad after the June 2013 elections to pick his successor.
A pivotal element, analysts say, is whether Ahmadinejad will revive his challenges to the alpha-omega powers of Supreme Leader Ayatollah Ali Khamenei and his backers, led by the Revolutionary Guard. The feud began last year with Ahmadinejad's drive to give the presidency more sway over key policies such as intelligence and foreign affairs _ which are firmly in the hands of the clerics.
That fight is lost. He can still, however, battle for a political ally on the presidential ballot next year, which will be Ahmadinejad's last in office because of term limits. He also can attempt to nudge Iran's position in the nuclear talks with the U.S. and other world powers, which are scheduled to resume next week in Moscow.
Ahmadinejad is seen as possibly more open to deals with Washington that would accommodate both sides: allowing Iran to continue some level of uranium enrichment for reactor fuel but giving more room for U.N. inspections. The negotiations, however, are completely overseen by the ruling system. And it's even possible, some analysts say, that Khamenei wants to avoid any possible breakthroughs with the West until Ahmadinejad is out of office _ fearing he could use it to gain political mileage.
"Ahmadinejad is a lame duck, and the ruling system wants to keep it that way," said Mehrzad Boroujerdi, a Syracuse University professor who follows Iranian affairs. "They want to keep him on a short leash. He'll yank back, though. It's the classic case of a weak office occupied by a strong personality."
Iran's presidency guides the mainstream economy and many day-to-day functions. But major decisions, from international affairs to military priorities, are controlled by the theocracy. This is where Ahmadinejad made his ill-fated gamble last year.
Dozens of Ahmadinejad's allies were arrested or purged from politics, and he was effectively stripped of his ability to groom a successor. An angry Khamenei even hinted that Iran could one day abandon the directly elected presidency system in favor of a prime minister.
Elections in February reinforced the anti-Ahmadinejad ranks in parliament. In March, Ahmadinejad became the first Iranian president brought before lawmakers for grilling over his policies and confrontations with Khamenei _ whose hard-core followers believe is answerable only to God.
It's left Ahmadinejad politically battered, but still with a sizable base of supporters among Iran's working classes and rural poor who see the ruling clerics as aloof and out of touch.
In a speech in May, Ahmadinejad indirectly took a swipe at the theocracy by praising the 1,000-year-old epic poem "Shahnameh," which recounts tales of Persia's pre-Islamic Zoroastrian religion. "Wherever there is justice, freedom and monotheism, there is Iran," he told the crowds.
"We will witness more hue and cry by Ahmadinejad," predicted independent Tehran-based political analyst Behrouz Shojaei.
This is what worries the ruling clerics.
It's not certain whether they fully sanctioned Ahmadinejad's most headline-grabbing statements over the years, including calling Israel a doomed state and questioning the extent of the Holocaust. But there is little doubt that Ahmadinejad's bluster has complicated negotiations over Iran's nuclear program, which Tehran insists is only for energy and medical research.
"Ahmadinejad is not likely to leave a shining legacy," said Ehsan Ahrari, a Virginia-based political analyst. "His rants about the so-called mythical nature of the Holocaust unnecessarily heightened tensions with Israel."
Gary Sick, an Iranian affairs expert at Columbia University, also believes all the bluster accounts for the world powers' tough negotiating stance in the nuclear talks. "The image he has created is that Iran is treacherous and extremely ideological by his loose talk and swaggering around," he said. "In many ways it's a false image, but he has reinforced this in the minds of the West."
Despite the heavy attention on Iran's external struggles _ including the future of critical ally Bashar Assad in Syria _ the coming year could be a highly inward-looking one for Iran. Ahmadinejad will be hunting for some type of post-presidency political role. Meanwhile, the ruling system will be vetting candidates for the next presidential election _ with all expectations that only reliable and pliable figures will make the cut.
The theocracy holds all the cards. It clears all candidates for the presidency and parliament. The message these days: Reformists, liberals and any others likely to challenge the ruling system are out.
Front-runners at the moment include Parliament Speaker Ali Larijani, Tehran Mayor Mohammad Bagher Qalibaf and ex-Revolutionary Guard commander Mohsen Rezaei. All would likely strike a more milder tone on the world stage than Ahmadinejad.
Meir Javedanfar, an Iranian-born political analyst based in Israel, said Khamenei feels particularly burned by Ahmadinejad after coddling him as the "son he always wanted." And the Revolutionary Guard "will try their level best to convince Khamenei to choose a yes man," said Javedanfar, co-author of the Ahmadinejad biography "The Nuclear Sphinx of Tehran."
The political freeze-out of Ahmadinejad, however, could free him up for greater grandstanding. Some believe he could go further with his challenges to the ruling system as a way to cater to his remaining supporters.
Still, Ahmadinejad is leaving people guessing. On his website last week, he wrote about how his concept of "justice" means not only facing enemies but also battling a "friend, comrade, party-mate and colleague."
It's unclear whether this was a warning shot of a new battle with the ruling clerics or a lament about how former conservative allies have abandoned him.
Of the five presidents since the 1979 Islamic Revolution, only two have moved onto prominent roles: Khamenei and Akbar Hashemi Rafsanjani, who also is a foe of Ahmadinejad dating back to the 2005 presidential election race. Ahmadinejad's predecessor, Mohammad Khatami, has been neutralized along with his reformist allies.
"Ahmadinejad does not want to fade away," said Sadegh Zibakalam, a Tehran University political science professor. "Considering his personality and character, it will be hard for him to leave the stage."
Associated Press writer Nasser Karimi in Tehran, Iran, contributed to this report.