BEIRUT (Reuters) - Former Iranian president Mahmoud Ahmadinejad, whose 2009 re-election prompted mass unrest over alleged vote rigging, has called for “free” presidential and parliamentary elections in an open letter to Supreme Leader Ayatollah Ali Khamenei.

FILE PHOTO - Iran's President Mahmoud Ahmadinejad talks during a news conference at the end of his visit to Cairo, Egypt February 7, 2013. REUTERS/Asmaa Waguih/File Photo

Khamenei backed Ahmadinejad after his return to power kicked off protests in which dozens of people were killed and hundreds arrested, rattling the ruling theocracy, before security forces led by the elite Revolutionary Guards stamped out the unrest.

But a rift developed between the two in 2011 when Khamenei, who has the ultimate say over all policy in the Islamic Republic, reversed Ahmadinejad’s dismissal of the minister of intelligence and suggested he had overstepped his authority.

Ahmadinejad, a brash, populist hardliner while in office, could not run in the 2013 election as he had served the maximum two consecutive terms. He was succeeded by pragmatist Hassan Rouhani, who won election by landslide then and again last year.

While Rouhani has called for a liberalisation of the economy and society and on the Revolutionary Guards not to interfere in elections, he has stopped short of explicitly advocating checks on the Supreme Leader’s powers - something Ahmadinejad addressed in the letter to Khamenei published on his website on Wednesday.

“An immediate and essential need is the holding of quick and free elections for the presidency and the parliament, of course without the engineering of the Guardian Council and interference of military and security institutions, so the people have the right to choose,” Ahmadinejad wrote.

“FUNDAMENTAL REFORMS”

His critics previously accused the Guardian Council, a body that vets presidential and parliamentary candidates with an eye to Khamenei’s wishes, of tilting elections in his favour in 2005 and 2009. However, Ahmadinejad was disqualified by the Council prior to last year’s presidential election.

Ahmadinejad’s letter also called for “fundamental reforms” in the three branches of government - executive, parliament and judiciary - as well as the office of the Supreme Leader. He did not elaborate on what reforms he had in mind.

But it is nearly unheard of in Iran for officials to publicly criticise Khamenei or his powers; insulting the Supreme Leader is a crime.

Serious unrest broke out in December for the first time since 2009, mainly over economic hardships but protesters soon targeted a perceived lack of democracy as well, demanding the removal of top officials including Khamenei.

At least 25 people were killed in the unrest and thousands detained before security forces cracked down in earnest and the protests fizzled out in January.

Ahmadinejad also called for the release of political prisoners and dismissal of hardline judiciary chief Ayatollah Sadeq Amoli Larijani, whom he has accused of unfairly targeting his allies.

Ahmadinejad’s presidency revolved around his appeal to Iran’s conservative, small-town working class and rural poor, and critics said his recent attacks on Iran’s clerical and security establishment after years of relative silence could be an attempt to lay the groundwork for a political comeback.

Rouhani’s popularity has waned over his failure to notably improve the economy and ease repression in everyday life despite his 2015 deal with world powers that secured an end to sanctions on Iran in return for curbs on its nuclear programme.

“Ahmadinejad and his group have become a lot more active in criticising the judiciary and government. He’s continuing on a populist path,” said Roozbeh Mirebrahimi, a journalist who worked for reformist Iranian dailies and now lives in New York.