What does the future hold for Mahmoud Ahmadinejad?

The ultra-conservative allies of Iran's Supreme Leader, Ayatollah Ali Khamenei, who President Mahmoud Ahmadinejad has fallen out of favour with, came out victorious in the first round of legislative elections. It's a major setback for Ahmadinejad, who is ending his second term weaker than before. Some in Iran fear that exposing its political divisions will play into the hands of the West at a time when Iran's under increasing pressure over its nuclear programme.