Iranians voted Friday in a presidential election that was tarnished by the state’s disqualification of prominent nonconservative candidates before the vote, and by accusations that the contest was engineered to deliver victory to a hard-line ally of Iran’s supreme leader.

The election, to replace President Hassan Rouhani, a political moderate who has served two terms, took place as Tehran negotiates with the United States and other world powers to revive a 2015 nuclear agreement in an effort to lift suffocating U.S. sanctions placed on Iran by the Trump administration.

Polls in the days leading up to the voting predicted historically low turnout amid soaring voter apathy and calls to boycott the election, further threatening the legitimacy of the contest. The election was also held amid a struggle to tame the coronavirus pandemic in Iran, which has suffered one of the deadliest outbreaks in the world.

The front-runner was Ebrahim Raisi, a conservative cleric viewed as a protege and possible successor to Ayatollah Ali Khamenei, Iran’s supreme leader. Raisi, who heads Iran’s judiciary, has been linked by human rights groups to mass killings of Iranian dissidents more than three decades ago. He has expressed opposition to negotiations with the United States and other Western governments but favors restoring the nuclear deal, a critical step toward reviving Iran’s economy.

His only real rival was Abdolnaser Hemmati, a political centrist who served as central bank governor and tried to rally support from Iranian moderate and reformist voters. But polls have shown Raisi with an overwhelming advantage over Hemmati and two other candidates.

Election officials said results would be announced on Saturday.

Iranian state media asserted Friday that voter turnout was high. Tehran’ s governor said it was higher than in previous contests, without providing figures. But journalists in Iran on Friday characterized traffic at many polling stations in the capital as lighter than usual.

Iran’s state Fars News Agency reported that as of 4:45 p.m. Friday, a holiday in Iran, 14 million people had voted, representing 23 percent of eligible voters.

Khamenei, who implored citizens to vote in televised remarks two days before the election, preemptively blamed low turnout on foreign plots. Speaking briefly as he cast his vote at 7 a.m. Friday, he reiterated his plea for Iranians to go to the polls.

“You all should come,” he said. “No one should say that nothing will happen with my one vote.”

The probability of a hard-line victory had set off an urgent debate among reformists about whether to participate in the election or to boycott it. In recent days, a more militant faction advocating a boycott had been threatening Iranian voters online.

On Friday, members of this faction were publishing pictures of voters’ faces on Twitter and calling them “mercenaries.”

“Expose and shame them by sending us their videos,” one Twitter user wrote.

Raisi was among seven men approved last month to run in the election by the 12-member Guardian Council, a body that vets candidates for elected office and whose decisions reflect the preferences of the supreme leader. Hundreds of other potential candidates were barred from running.

The council’s selections drew harsh criticism for disqualifying several prominent figures associated with centrist or reformist factions, including Ali Larijani, a former parliament speaker and nuclear negotiator, and Eshaq Jahangiri, a reformist and Rouhani’s vice president.