TEHRAN — There was a time when Ali Akbar Hashemi Rafsanjani seemed to have it all. A founder of the Islamic Revolution, he headed a family empire that owned the second biggest Iranian airline, Mahan, had a near monopoly on the lucrative pistachio trade and controlled the country’s largest private university, Azad.

But then things started to go wrong. Iranians, angered by his wealth, back-room dealings and supposed involvement in the killing of dissidents, nicknamed him “Akbar Shah,” after the old Persian rulers who sat on velvet cushions in lush courtyards. Political rivals, jealous of his grip on the economy, seized on his support for reformists and labeled him an “aristocrat,” a “capitalist” and a supporter of “American Islam”

His political stock fell so low that in 2002 he could not even muster the votes to win a seat in Parliament. He suffered a humiliating defeat at the hands of Mahmoud Ahmadinejad in the 2005 presidential election, and two of his children ended up in jail. His speech in favor of greater freedom during the 2009 protests alienated him from Iran’s conservative clerics and military commanders.

Now, from the fringes of Iran’s closed circle of power, Mr. Rafsanjani, 79, is attempting a comeback, entering his name last Saturday for the June 14 presidential elections. Though once widely reviled, his reputation as an economic pragmatist and modernizer — by Iranian standards, anyway — seems to be hitting a responsive chord with the public.