In a makeshift campaign war room in north Tehran, two dozen young women clad in head scarves and black chadors are logging election data into desktop computers 24 hours a day, while men rush around them carrying voter surveys and district maps.
This nerve center in the campaign to unseat Mahmoud Ahmadinejad, Iran’s hard-line president, is not run by any of the three candidates who are challenging him in a hotly contested election on Friday.
Instead, it is part of a bitter behind-the-scenes rivalry that has helped define the campaign, pitting Mr. Ahmadinejad against the man he beat in the last election, Ali Akbar Hashemi Rafsanjani, a two-term former president and one of Iran’s richest and most powerful men.
On Tuesday, Mr. Rafsanjani, who is backing the campaign against the president and whose son runs the war room, released an extraordinary open letter in which he complained about what he called the president’s “insults, lies and false allegations” and asked the country’s supreme leader, Ayatollah Ali Khamenei, to intervene.
During a campaign debate with the strongest challenger a week ago, Mr. Ahmadinejad accused Mr. Rafsanjani of stealing billions of dollars of state money and called him “the main puppet master” behind the campaign against him.
The president clearly hopes to associate his challengers with Mr. Rafsanjani, who is one of the Islamic republic’s founding figures but is widely viewed as corrupt.
Mr. Rafsanjani is striking back, accusing Mr. Ahmadinejad of undermining the state itself. His letter casts Mr. Ahmadinejad’s election broadsides — aimed at several figures who were close to Ayatollah Ruhollah Khomeini, the father of the 1979 revolution — as an attack on the country’s senior political class and therefore on the legitimacy of the entire system.
“If the system cannot or does not want to confront such ugly and sin-infected phenomena as insults, lies, and false allegations made in that debate, how can we consider ourselves followers of the sacred Islamic system?” Mr. Rafsanjani wrote.
The bitter exchanges have underscored the surprising vigor of Iran’s limited democracy. The country’s theocratic rulers weed out all but a few ideologically acceptable candidates before each election. But within those confines, the races are hard-fought and unpredictable.
No sooner had Mr. Rafsanjani’s letter been released than Mr. Ahmadinejad’s campaign began copying and distributing it, clearly betting that it would play in the president’s favor to keep Mr. Rafsanjani in the spotlight, said Mohammad Ali Abtahi, the president of the Institute for Interreligious Dialogue, a research organization here.
Thousands of Mr. Ahmadinejad’s supporters marched through central Tehran on Wednesday morning, the last full day that campaigning is allowed before the vote on Friday. Hours later, a larger throng of supporters of the leading challenger, Mir Hussein Moussavi, rallied in the capital, with tens of thousands of people bearing the signature green headbands, ribbons and caps of his campaign.
Although the rallies have been mostly peaceful, the enormous street presence by Mr. Moussavi’s supporters has clearly rattled some in the government. On Wednesday, a senior official of Iran’s Revolutionary Guards accused the Moussavi campaign of trying to start a “velvet revolution,” according to comments published on the Guards’ Web site.
In his letter, Mr. Rafsanjani noted that Ayatollah Khamenei had “deemed it best to remain silent” instead of censuring the president for his vitriolic attacks during the debate. Mr. Rafsanjani said he wrote the letter only after the rejection of his demands for an apology and for an opportunity to rebut the charges against him on state television.
Ayatollah Khamenei is unlikely to respond because “he is not pleased with correspondence like this from anyone,” Mr. Abtahi said. Although Mr. Khamenei has the final say on affairs of state, he prefers to rule by consensus, steering clear of divisive issues.
Mr. Rafsanjani’s letter is especially significant because he leads the Assembly of Experts, an 86-member body of senior clerics that has the power to remove the supreme leader, Mr. Abtahi said. It included a veiled threat: Mr. Rafsanjani implicitly compared Mr. Ahmadinejad to a former president whom Mr. Rafsanjani helped depose in 1981.
In the 2005 presidential elections, Mr. Rafsanjani lost to Mr. Ahmadinejad in a landslide, with many reform-minded voters abstaining. At that time, Mr. Ahmadinejad was relatively unknown, and commentators here say he won in large part because of his rival’s deep unpopularity.
In this year’s campaign, Mr. Moussavi, a former prime minister with a reputation for honesty and competence, has emerged as Mr. Ahmadinejad’s strongest challenger. In recent weeks his campaign has gained tremendous energy, and huge rallies by his supporters have packed the streets of the capital day and night.
Mr. Moussavi and others have derided the president’s efforts to associate them with Mr. Rafsanjani. But it is clear that Mr. Rafsanjani’s family is playing a powerful role in supporting Mr. Moussavi’s campaign — whether by invitation or not.
Mr. Rafsanjani’s 39-year-old son, Mehdi Hashemi Rafsanjani, directs the sophisticated electoral effort based at Islamic Azad University, which was founded by his father. It is here that the young women, paid $20 to $25 a day, can be seen at all hours assembling data to help election monitors observe the vote on Friday.
“This is parallel to the Interior Ministry,” which oversees the election, the younger Mr. Rafsanjani said with a smile. “But ours is secret.”
The university’s campaign team has developed its own software for doing election polls, and has given 1,000 phones equipped with it to campaign workers who fan out across the country to do face-to-face questionnaires. They type the answers directly into the phones, and then transmit them back to the Tehran headquarters by text message, Mr. Rafsanjani said. The surveys are being done almost continuously, and the latest show Mr. Moussavi with at least 56 percent of the vote, compared with a maximum of 42 percent for Mr. Ahmadinejad, he said.
In his final campaign appearance on state television Wednesday evening, Mr. Ahmadinejad referred contemptuously to the university’s role in the campaign against him, saying it “destroys the credibility of academia.”
One of the main concerns of the elder Mr. Rafsanjani’s letter — and of the entire campaign — is that Mr. Ahmadinejad will rig the vote in his favor.
In 2005, there were accusations of fraud after the initial round of voting, when Mr. Ahmadinejad unexpectedly emerged in first place. Those accusations were never proved, but many commentators believe that the government retains the power to steal the election as long as it is close.
“We have 50,000 observers in these elections,” Mehdi Rafsanjani said. “If anyone is barred from a ballot box, we will find out.”
Nazila Fathi contributed reporting.
This story, "," originally appeared in The New York Times.