Ahmadinejad's Rasputin: Esfandiar Rahim Mashaei

Ahmadinejad orates under the gaze of the ayatollahs. Conservative infighting is rife in Iran. Behrouz Mehri / AFP-Getty Images

Like many Iranian officials, Esfandiar Rahim Mashaei attended the ceremony for the anniversary of the 1979 revolution in Tehran earlier this year. The event hasn't changed much over the decades; there were the usual bombastic speeches and flag waving. But Mashaei, chief of staff of President Mahmoud Ahmadinejad, encountered a very unordinary scene on the way back to his car. An enraged mob circled him. "Die, Mashaei!" one woman yelled. "Mashaei, get out of the government!" a group of men jeered. The crowd jostled him for several minutes before his bodyguards cleared the way for a hasty exit.

Mashaei has been a divisive figure in Iran for years, both because of his close relations with the president—his daughter is married to Ahmadinejad's son—and because of his unorthodox religious beliefs, which some clerics see as a threat to the entire foundation of the Islamic Republic. Ahmadinejad also appears to be grooming Mashaei, 51, to replace him as president, a move that has infuriated many hardline supporters of Supreme Leader Ayatollah Ali Khamenei.

In recent weeks, tensions among conservatives at the top have boiled over. Several hardline websites published a letter allegedly linking Mashaei to a $2.6 billion embezzlement scandal—the biggest in Iranian history—which may land him in jail and could even bring serious legal trouble for Ahmadinejad. One hardline M.P., in comments directed at Mashaei, said the punishment for involvement in the financial fraud should be execution. The judiciary seems to be closing in; two weeks ago, one of Mashaei's relatives was arrested for alleged links to the scandal. "Any time Mashaei is involved in a controversial issue, Ahmadinejad is also involved. Behind the scenes, Mashaei and Ahmadinejad are one," says Mehdi Khazali, a political analyst whose father is a senior cleric close to Khamenei. "Ahmadinejad's fight with Khamenei and his supporters is real and serious. The goal is to sideline the Supreme Leader."

As the conflict reaches a critical point, the fates of Ahmadinejad and Mashaei are now inseparable. As with the president, Mashaei's ambitions far exceeded his humble origins. He was born in Ramsar, a small town on the Caspian coast, but managed to leave and get a degree in electrical engineering. When the revolution swept across Iran in the late '70s, he joined enthusiastically and even served in a branch of the Intelligence Ministry in his hometown after the shah was ousted.

After the war with Iraq started in 1980, Mashaei joined hundreds of other zealous young men heading to Iran's volatile northwest region, where the Kurdish minority was staging a full revolt. It was a lawless, dangerous place, but Mashaei wasn't involved in much fighting, according to an opposition activist who knew him at the time. "He was mostly doing public-affairs and cultural work," says the activist, who didn't want to be identified because of the possibility of arrest. Some controversial traits that have landed Mashaei in trouble more recently were on display back then, specifically a belief that he has a special bond with the 12th Shiite imam, known in Farsi as Imam Zaman. "He had this belief in his friendship with the Imam Zaman," the activist says. "Every so often he would stop walking and greet the imam."

It was there that Mashaei met the man who would change his life. Ahmadinejad was governor of a northwest province, and the two became friends. After the war, Mashaei held a variety of government jobs in Tehran, but the two kept in touch. When Ahmadinejad was appointed Tehran's mayor, he tapped Mashaei to serve in a cultural post. This was the beginning of a close political bond that has extended throughout Ahmadinejad's presidency. "They are both coming from the pa berahneha [literally "bare feet," a reference to the poor]. They have a lot in common," says Hooshang Amirahmadi, president of the American Iranian Council, who has met both men. "They have a very deep and multifaceted relationship." Others see a darker side to the bond. "Mashaei is Ahmadinejad's Rasputin," says Karim Sadjadpour, a Carnegie Endowment analyst.

The controversies surrounding Mashaei have piled on during Ahmadinejad's two terms. There was his 2008 declaration that Iranians and Israelis are friends, as well as the praise for Iran's pre-Islamic past, both big taboos. There was his hobnobbing with starlets and a ceremony in Turkey with dancing women, hardly the actions of a pious man. But he has stirred up the most controversy with repeated comments that seem to question the need for the clergy. At each turn, the hardline press, politicians, and clerics have howled with anger, but Mashaei has refused to back down. "I'm a soldier and I'm not going to give up, even if it's over my dead body," he said defiantly at a meeting with clerics and religious students last year.

Ahmadinejad has stuck steadfastly by him through the storm. When the president nominated Mashaei as one of his vice presidents shortly after the 2009 elections, Khamenei publicly demanded that Mashaei had to go. Ahmadinejad re-moved him from that post but made him chief of staff, a clear snub to Khamenei. "Ahmadinejad's stubborn defense of Mashaei bespeaks his importance as a key advisor for the increasingly isolated president," noted a 2010 U.S. diplomatic cable released by WikiLeaks. Mashaei now holds more than a dozen government posts, including special representative for Middle Eastern affairs. He also travels regularly with Ahmadinejad on important trips to the U.S. and in the region.

But this unwavering defense has come at a price: Ahmadinejad has bitterly clashed with Khamenei and elements of the Revolutionary Guards, and some observers question whether he'll finish out his presidency next year. When Ahmadinejad tried to dismiss Intelligence Minister Heydar Moslehi in the spring, Khamenei reinstated the man. The feud didn't end there. An elaborate smear campaign soon spread through conservative media outlets accusing Mashaei and a circle of his associates of practicing sorcery and summoning jinns. Some two dozen members of Ahmadinejad's inner circle were arrested, and intelligence agents reportedly bugged Mashaei's office at Khamenei's behest. The conservative press now regularly refers to Mashaei as the "head of the deviant group."

Ahmadinejad claims the current scandal is an extension of this smear campaign. The scheme involved a number of fake letters of credit used to get financing to buy newly privatized companies. The most damning evidence against Ahmadinejad and his crew is a letter, which appears to be signed by Mashaei, calling for the minister of economy to facilitate the sale of one of the companies. The minister narrowly avoided an impeachment vote in Parliament three weeks ago. But the internal rivalries can be kept in check for only so long. The knives are bound to come out ahead of parliamentary elections next spring, and even more for the presidential election scheduled for 2013, when Mashaei may run. "Mashaei certainly still does have presidential ambitions. I think Ahmadinejad very much wants him to be the next president," says Amirahmadi. Perhaps that's why Khamenei hinted in a recent speech that the office of president may be abolished altogether.

Ahmadinejad's Rasputin: Esfandiar Rahim Mashaei | World