In Niccolo Machiavelli’s The Prince, he describes a “general rule” of politics that “never or rarely fails.” “He who is the cause of another becoming powerful,” Machiavelli wrote, “is ruined. Because that predominancy has been brought about either by astuteness or else by force, and both are distrusted by him who has been raised to power.” This is an apt political epitaph for former Iranian President Ali Akbar Hashemi Rafsanjani, who died Sunday at age 82. In 1989, nearly 500 years after The Prince was published, Rafsanjani helped anoint his longtime comrade Ayatollah Ali Khamenei as supreme leader of Iran. He would spend the next three decades of his life trying, unsuccessfully, to wrestle power back from the man he enthroned.

The Rafsanjani-Khamenei friendship-cum-rivalry resembles a Shiite Shakespearean drama. It began over five decades ago, when both were acolytes of the Ayatollah Khomeini who traded their seminary studies for a life of political agitation against the monarchy of Shah Mohammed Reza Pahlavi. Both men spent years in and out of prison in the 1960s and 1970s, Rafsanjani for his alleged role in the assassination of Iranian Prime Minister Hassan Ali Mansur in 1965. While Khamenei used his time in prison to translate the works of Egyptian militant Islamist Sayed Qutb, Rafsanjani wrote a book about a 19th-century nationalist prime minister named Amir Kabir, who had been assassinated. Fellow prisoner Abbas Milani, now a scholar at Stanford University, recalled that Rafsanjani was also an “enthusiastic but clumsy volleyballer.”

The 1979 revolution catapulted both men from anonymity into power. Khamenei became Iran’s president and Rafsanjani a much more powerful speaker of parliament, given his close rapport with Khomeini. When Khomeini died in 1989 with no clear successors, Rafsanjani claimed, without proof, that the revolutionary leader’s dying wish was for Khamenei to succeed him. A remarkable video of these clerical deliberations was leaked by the Rafsanjani family for a Swedish documentary years ago.

Rafsanjani likely believed Khamenei would be a weak, pliant supreme leader whom he could control. This initial meekness was reflected in Khamenei’s inaugural speech. “I am an individual with many faults and shortcomings,” he said, “and truly a minor seminarian.” In time, however, a power rivalry between the two men naturally emerged, and their distinct worldviews became clearer. Rafsanjani was motivated by reconstruction (in the aftermath of the ruinous Iran-Iraq war) and wealth creation (both his own and the country’s) more than ideology, and Khamenei, in contrast, believed that compromising on revolutionary principles would hasten the regime’s collapse, just as perestroika helped undo the Soviet Union.

To stay in power, both men were willing to imprison and assassinate regime critics, at home as well as abroad. But key differences emerged between them on foreign policy. For Rafsanjani Iran’s support for radicalism seemed to be a means to an end, while for Khamenei it was an end unto itself. Khamenei opposed relations with the United States and was hostile to Saudi Arabia, while Rafsanjani favored détente with Washington and a cordial working relationship with Riyadh. (The Iranian chef at the al-Khayyam Persian restaurant at the Hilton in Jeddah, Saudi Arabia, once told me that the Rafsanjani family dined with them several times a year when visiting Mecca.)

The fundamental differences between the two men were also reflected in their families. Khamenei grew up the son of a poor cleric in the Shiite holy city of Mashad, and each of his four sons became clerics. Rafsanjani’s family were pistachio merchants from the sun-soaked southeastern province of Kerman, and his three sons became businessmen. Khamenei’s reputation for asceticism prolonged his political longevity, while the fortunes allegedly amassed by Rafsanjani and his children brought about their political demise.

This was evidenced in Iran’s 2005 presidential election, when Rafsanjani faced the then-obscure populist mayor of Tehran, Mahmoud Ahmadinejad, in a second round run-off. I was based in Tehran then and remember an artist friend who shunned politics but had been urged by her friends to vote against Ahmadinejad. His election would further curtail civil liberties, they warned. “I wrote Rafsanjani’s name on the ballot,” she told me, “but I could not get myself to physically drop it in the ballot box.” For Iranians who lived through the 1980s and 1990s, Rafsanjani was not the antidote to corruption and repression—he embodied it. Ahmadinejad won handily; Rafsanjani was humiliated. 

As the revolution aged it grew more militarized—the Revolutionary Guards soon eclipsed the political and economic authority of the clergy—while Rafsanjani, in contrast, mellowed with age. In 2009 Rafsanjani spoke out against Ahmadinejad’s tainted reelection—which provoked massive popular uprisings—though he stopped short of criticism that could unsettle the Islamic establishment that he had ruthlessly helped create. He may have resented Khamenei, but he understood that if they did not hang together, they would hang separately.    

Iranians of a younger generation remembered him less for his corruption, and more as a counterweight against the country’s hardline forces. That many young Iranians hoped, despite his advanced age, that Rafsanjani could bring them deliverance was more a reflection of their desperation for change than a genuine affinity for an 82-year-old cleric. “It's not that we liked him,” wrote one young Iranian on Twitter after his death, “We needed him.”

While Rafsanjani likely hoped to be remembered by history as a modernizing nationalist hero, like his biographical subject Amir Kabir, historians are not likely to be so generous. He deserves credit for creating an “Open University” system that helped educate millions of Iranians, and for mentoring a competent younger generation of technocrats and diplomats, like Foreign Minister Javad Zarif.

But Rafsanjani’s political career spanned a period in which Iran exiled millions of its inhabitants, imprisoned and executed tens of thousands, and needlessly prolonged a war, with Saddam Hussein’s Iraq, that brought about some half a million casualties by one estimate. Rafsanjani was at worst directly complicit in these policies and at best a silent bystander. He advocated mercy and moderation when out of power, but he exhibited insufficient amounts of it when he was in power.

The impact of Rafsanjani’s death on Iranian politics will be better understood in the coming months. President Hassan Rouhani, a Rafsanjani protege, is up for reelection in May 2017. Whatever the outcome, however, Rafsanjani’s death is not likely to change the longstanding fundamentals of power in Tehran that Rafsanjani helped shape. Though he was called Machiavellian in numerous obituaries, he was vanquished by the man whom he appointed, Ali Khamenei, whose careful cultivation of Iran’s security forces made clear he understood the most important Machiavellian rule of all. For authoritarian leaders it is preferable to have people’s fears rather than their affections. Rafsanjani had neither.

This article was originally published at the Atlantic