Tehran Mayor Mohammad Bagher Ghalibaf appears at a presidential campaign rally in Tehran on May 14. (Atta Kenare/AFP/Getty Images)

Iranian presidential hopeful Mohammad Bagher Ghalibaf withdrew Monday from the race to unseat the country’s moderate leader, in a move to unite conservatives behind fellow hard-liner Ebrahim Raisi in the homestretch for Friday’s election.

The two candidates were the top conservative challengers to President Hassan Rouhani, a pragmatist whose government negotiated a 2015 deal with world powers to rein in Iran’s nuclear program in exchange for lifting international sanctions.

Ghalibaf and Raisi, who were polling neck and neck, seized on widespread discontent about the slow-growing economy. Although sanctions relief has allowed oil exports to resume, the limited growth has not greatly improved the lives of ordinary Iranians.

Ghalibaf ran on job creation and boosting cash subsidies. But his withdrawal Monday solidified Raisi’s status as the front-runner for conservatives, who have struggled in past elections to coalesce around one candidate.

Recent polls showed Rouhani with a comfortable lead over Raisi, but such surveys are unreliable in Iran, which limits political activity and free expression.

“I ask my supporters throughout the country to use all of their potential” to elect Raisi, Ghalibaf said in a statement carried by state media.

The promise of Iran’s 1979 Islamic revolution “can only be achieved by changing the status quo,” he said. He called a vote for Raisi a “crucial decision” to “preserve the unity” of the revolution.

Ghalibaf’s withdrawal “was likely an orchestrated move to shore up support behind a single principlist candidate and pose a potent challenge to Rouhani,” said Behnam Ben Taleblu, an Iran analyst at the Foundation for Defense of Democracies, a think tank based in Washington. Iran’s hard-line conservatives are widely known as “principlists.”

“Iran’s political right has been scrambling to field a single candidate” who could counter Rouhani’s coalition of technocrats, pragmatists and reformers, Taleblu said.

Although Rouhani is still favored to win, “it is highly likely that Ghalibaf’s voters will flock to Raisi,” Taleblu said.

Raisi, a 56-year-old Shiite cleric, has close ties to Iran’s supreme leader, Ayatollah Ali Khamenei, who last year appointed him as head of Iran’s largest charitable foundation, the Astan Quds Razavi. He served for years on the judiciary, including on a 1988 panel accused of sentencing thousands of political prisoners to death.

But he has limited political experience and gave weak performances in three televised presidential debates. His links to Iran’s powerful Revolutionary Guard Corps and hard-line ruling clerics could push undecided voters to the Rouhani camp. Rouhani, 68, is also a Shiite cleric.

“So far, Raisi has received support from the shadowy corners of the Iranian security establishment,” Taleblu said. But he “has failed to touch off a national movement.”

A survey released Monday by the official Islamic Republic News Agency said that about 67 percent of voters plan to cast ballots for president.

High voter turnout has generally favored moderate and reformist candidates in Iran. Over the weekend, Rouhani picked up endorsements from opposition leader ­Mehdi Karroubi and Academy Award-winning Iranian film director Asghar Farhadi.

Karroubi, a reformist candidate who led protests following the disputed 2009 presidential election, is under house arrest. Rouhani supporters chanted the names of Karroubi and Mir Hossein Mousavi, another reformist leader under house arrest, at rallies nationwide.

As a candidate in 2013, Rouhani had pledged to free Karroubi and Mousavi, as well as Mousavi’s wife, Zahra Rahnavard.