The widespread rout of the Iran president's supporters could consign him to a lame-duck status for his 18 remaining months in office.
Ahmadinejad is left isolated as Khamenei tightens his grip in elections
Iran's supreme leader, Ayatollah Ali Khamenei, has strengthened his control over the country's fractious ruling hardliners after loyalists won more than 75 per cent of the seats in parliamentary elections at the expense of his president, Mahmoud Ahmadinejad, an almost complete count of the vote showed last night.
Overall, the 290-seat parliament, known as the Majlis, is set to be virtually entirely conservative, with the previous 60 reformist MPs pared down to a bare handful.
The widespread rout of the president's supporters could consign him to a lame-duck status for his 18 remaining months in office, but the combative and irrepressible Mr Ahmadinejad is likely to strenuously buck attempts to curtail his power
Even so, the outcome of Friday's poll will likely scotch his hopes of priming an ally to succeed him in next year's presidential election.
That will be a relief to Ayatollah Khamenei, who wants a pliant president after his bruising experience with Mr Ahmadinejad, whom he once championed.
The new parliament is likely to continue most of the policies of the outgoing one, including strong support for Iran's nuclear programme. But with the president weakened the nuclear crisis could deepen.
Mr Ahmadinejad was seemingly keen to reopen stalled negotiations with world powers, believing that rapprochement with the West would be popular with the Iranian electorate.
Ayatollah Khamenei has given the green light for new talks but is said to see little value in them, convinced the United States is using the nuclear issue as a pretext to push for regime change in Tehran.
To simplify Iran's convoluted political scene, foreign media generally portrayed the parliamentary elections as a showdown between supporters of the 55-year-old president and allies of the septuagenarian supreme leader. The true picture was more complex.
Many candidates from the most prominent conservative faction that was highly critical of Mr Ahmadinejad also appeared on the list of a smaller, more radical faction deemed tacitly supportive of the president - although it is stridently opposed to his chief of staff, Esfandiar Rahim Mashaie.
"It appears that the era of 'Ahmadinejadism' in Iran's political history is gradually coming to an end," said Davoud Hermidas Bavand, a prominent, Tehran-based political analyst.
But another expert, Hamid Farahvashian, said: "Ahmadinejad's camp has not been demolished. We have to wait and see what happens after the new parliament convenes in June."
It is unclear whether Mr Ahmadinejad will still be hauled before parliament for a grilling on his handling of the economy and his past challenges to Ayatollah Khamenei's absolute authority. That unprecedented encounter in the chamber, which could lead to the president's impeachment, is scheduled to take place within days.
But many of the politicians who last month signed the petition to summon the president will not be in the new parliament. Some did not run or were disqualified while others lost their contests.
Provided Mr Ahmadinejad accepts that his power has been curbed, Ayatollah Khamenei will be happy to see him serving out the remainder of his second, four-year term in office.
Any attempt to remove the president before then would cause more instability while the regime is attempting to foster the impression of unity as it faces unprecedented western pressure over its nuclear programme.
Barack Obama, the US president, is scheduled to hold talks today at the White House with Israel's hawkish prime minister, Benjamin Netanyahu, who is seeking American backing for possible military strikes against Iran's nuclear facilities.
Mr Ahmadinejad also serves as a useful lightning rod for popular discontent: he is taking much of the blame for the country's economic troubles, deflecting criticism away from Ayatollah Khamenei and other ruling hardliners.
The vote was a limited test of political opinion since leading reformist groups had either boycotted the election or were banned from competing.
The two main opposition leaders, Mir Hossein Mousavi and Mehdi Karrubi, who ran for president in the 2009 election that returned Mr Ahmadinejad to power, have been under strict house arrest for more than a year. They alleged his "stolen" re-election was the result of a rigged ballot, igniting the biggest street protests in 33 year-old history of the Islamic republic.
This time there were no immediate claims of irregularities, although an exception was made by the president's younger sister, Parvin Ahmadinejad, who was defeated by a conservative rival in their family hometown. She attributed her embarrassing loss to electoral fraud and vowed to make a formal complaint.
Even in rural areas that have been strongholds of Mr Ahmadinejad and his populist brand of non-clerical nationalism, loyalists of Ayatollah Khamenei appeared to have swept about 70 per cent of the seats.
The regime declared an "epic-making" voter turnout of 64 per cent, significantly higher than the 55 per cent recorded in the last parliamentary elections in 2008. This, according to Iran's state-run media highlighted the regime's popular legitimacy and was a "great slap in the dirty and hateful face of the West".
All candidates were screened for their loyalty to the Islamic establishment by an unelected, hardline vetting body of clerics and jurists controlled by Ayatollah Khamenei.