Three days before the presidential election, moderates and reformists in Iran are coalescing behind Hassan Rouhani, a cleric and former nuclear negotiator, as their best hope of staving off a field of divided conservatives, who had been seen as having the upper hand in the race.

Among those endorsing Rouhani are two former presidents, including Mohammad Khatami, who threw his support behind the candidate on Tuesday after the withdrawal of reformist Mohammad Reza Aref, who had served as Khatami’s vice president during his first term. Ali Akbar Rafsanjani, whose presidential bid was thwarted by the clerical body tasked with vetting candidates, also has endorsed Rouhani.

The withdrawal of Aref, a ­Stanford-educated engineer, added to a growing sense of hope within Rouhani’s campaign, which includes reformists and moderates and is banking on winning the votes of Iranians tired of their country’s diplomatic and economic isolation.

“It was never about me or Dr. Aref,” Rouhani said in a statement thanking Aref. “It has always been about our shared goals.”

The field of candidates has dwindled to six, with Gholam Ali Haddad-Adel, a hard-line former speaker of parliament, also exiting. The remaining candidates include three prominent conservatives. Haddad-Adel did not endorse any of them, underscoring the divisions among the conservatives.

Who will be the next president of Iran? Here are the eight candidates running in the upcoming presidential election.

Rouhani is seen by many Iranians as a unifier with a track record of working well with different factions. He is also considered one of the Islamic republic’s most seasoned foreign policy officials, and his supporters point to the relative success that Iran enjoyed when he led the nuclear negotiations team during Khatami’s presidency.

“Our economic problems are because of our political problems, and we need a president who can solve our issues with the rest of the world. I am sure he will use experienced ministers from the left and the right because his past shows his ability to work with everyone,” said pharmacy clerk Shahram Majidi, who plans to vote for Rouhani.

The surge in enthusiasm about Rouhani among moderates and reformers cannot be compared to the events leading up to the 2009 election and the protest movement that followed. But both Khatami and Rafsanjani enjoy widespread support among Iranians, and their endorsements gave hope to reformers fearful of a conservative victory. The Friday election will be followed by a two-man runoff if none of the candidates wins an outright majority.

Opinion polls in Iran are notoriously unreliable, but a growing number of voters are attracted to Rouhani — if not for what he stands for, then because of who stands with him.

Since announcing his run in early April, Rouhani has spoken more than any other candidate about what he would do for women and ethnic minorities if elected, including forming a ministry of women.

Such pledges have won him growing support among liberal-minded Iranians, especially the young. Rouhani’s campaign rallies, which have attracted thousands of supporters in cities across Iran, have featured large contingents of tribal minorities and many first-time voters who see in him a connection to the reform movement of the late 1990s and early 2000s, before the extremism that took hold with the election of Mahmoud Ahmadinejad in 2005.

“He is looking at economic and political development together,” said Akbar Torkan, a senior campaign adviser to Rouhani who also served as a minister under Rafsanjani.

Some influential coalitions of clerics are supporting more-
conservative candidates, especially former foreign minister Ali Akbar Velayati, who is a close adviser to Ayatollah Ali Khamenei, the nation’s supreme leader, and nuclear negotiator Saeed Jalili.

But Rafsanjani and Khatami are clerics themselves, and although Rouhani’s status as a cleric may diminish his credibility among some segments of Iranian society, his background and rhetoric are clearly more geared toward change compared with the other candidates.

“He is a cleric, but he sympathizes with the ordinary people and can relate to the younger people’s problems and our concerns,” said Fahimeh Rahimi, a 32-year-old secretary. “For me, he is another Khatami.”

In his statement Tuesday, Khatami, who served as Iran’s president from 1997 to 2005, said, “I will vote for my dear brother, Dr. Rouhani and ask everyone, especially reformists and those who care for the dignity of our country to take this opportunity and vote for Rouhani.”