Generations have grown up with a heroic Robin Hood ideal of stealing from the rich and giving to the poor. So did Iran’s former President Mahmoud Ahmadinejad and his associates, who seem to have been inspired by the first part of the legend but not necessarily the second.

This much is apparent from the stream of indictments against Ahmadinejad and his circle but the legal and political battle is having an extraordinary effect on al-Quds Force of the Islamic Revolutionary Guard Corps (IRGC), which Ahmadinejad is trying to drag down with him.

The scandalous affair began last November with the Tehran Justice Administration’s prosecution on embezzlement charges of Hamid Baghaei, Ahmadinejad’s vice-president. Baghaei was not in court, having sought refuge at the Hazrat-e Abd al-Azim shrine in Rey, south of Tehran, but he was sentenced to 15 years in prison and fined $100,000. He was arrested March 14.

Ahmadinejad came to the rescue of his old friend, accusing the judiciary of being corrupt. More remarkably, Ahmadinejad published an open letter addressed to al-Quds Force commander Major-General Qassem Soleimani. Urging Soleimani not to “be guilty of injustice,” Ahmadinejad threatened to disclose prior correspondence with him.

Even as Ahmadinejad’s threats appeared on a friendly website, dolatebahar.com, security forces arrested Esfandiar Rahim-Mashaei, former vice-president and a close confidante of Ahmadinejad. The charges against him remain unclear.

Ahmadinejad reacted to Mashaei’s arrest by disclosing that the judiciary had handed him over to the IRGC Intelligence Organisation. He subsequently wrote a few open letters to Iranian Supreme Leader Ayatollah Ali Khamenei complaining of the “lack of freedom in Iran for the past 40 years!” Finally, Ahmadinejad disclosed Baghaei’s letter to Soleimani after prosecution charges had been brought against him.

The letter, dated February 6, dwelt on money. Baghaei wrote: “Mr Hossein Taeb, IRGC Intelligence Organisation chief, claims al-Quds Force, on August 5, 2013, paid me [$4.3 million] to distribute as a gift among certain African heads of state… of which $570,000 was allegedly embezzled by me. This claim is a lie.”

Half a million dollars is hardly a small sum but it is dwarfed by the hundreds of millions, if not billions, of dollars of public funds that disappeared during the eight years of Ahmadinejad’s presidency. Most of the money disappeared into a complex web — of individuals and companies established by the Ahmadinejad government to sell Iran’s oil while evading international sanctions.

Ahmadinejad’s reaction to the crackdown on his allies, however, appears to be a populist attempt to take advantage of anti-regime sentiments. He seems to want to remain politically relevant, but in so doing, is virtually taking Soleimani and al-Quds Force hostage.

The same people who are outraged by the regime’s use of taxpayers’ money to support Bashar Assad’s regime in Syria will probably be outraged by accusations al-Quds Force sought to bribe certain African heads of state. Disaffected sections of the population will be angered that their government was engaged in such activity instead of improving the lot of the average Iranian.

Seen in this way, Ahmadinejad and his associates may win some public sympathy for stealing from the rich despite not giving to the poor.