Female voters queue at a polling station for the presidential and municipal council election in the city of Qom, 78 miles (125 kilometers) south of the capital Tehran, Iran, Friday, May 19, 2017. Iranians began voting Friday in the country's first presidential election since its nuclear deal with world powers, as incumbent Hassan Rouhani faced a staunch challenge from a hard-line opponent over his outreach to the wider world. (AP Photo/Ebrahim Noroozi)
Female voters queue at a polling station for the presidential and municipal council election in the city of Qom, 78 miles (125 kilometers) south of the capital Tehran, Iran, Friday, May 19, 2017. Iranians began voting Friday in the country's first presidential election since its nuclear deal with world powers, as incumbent Hassan Rouhani faced a staunch challenge from a hard-line opponent over his outreach to the wider world. (AP Photo/Ebrahim Noroozi) Credit: Ebrahim Noroozi

TEHRAN, Iran — Millions of Iranians voted late into the night Friday to decide whether incumbent President Hassan Rouhani deserves another four years in office after securing a landmark nuclear deal, or if the sluggish economy demands a new hard-line leader who could return the country to a more confrontational path with the West.

The Islamic Republic’s first presidential election since the 2015 nuclear accord drew surprisingly large numbers of voters to polling stations, with some reporting waiting in line for hours to cast their votes. Election officials extended voting hours at least three times at the more than 63,000 polling places to accommodate the crowds.

Four candidates remain in the race. But for most voters only two mattered, both of them clerics with very different views for the country’s future: Rouhani and hard-line law professor and former prosecutor Ebrahim Raisi.

Rouhani is a political moderate by Iranian standards, but the 68-year-old has come to embody more liberal and reform-minded Iranians’ hopes for greater political freedom at home and better relations with the outside world.

His supporters are also hoping he can make better progress on improving the economy, a key issue on the minds of the country’s 56 million eligible voters. Many say they are yet to see the benefits of the nuclear deal, which saw Iran limit its contested nuclear program over the objection of hard-liners in exchange for the lifting of some sanctions.

In Tehran, whose liberal and affluent voters form the bedrock of support for Rouhani, lines at some precincts were much longer than those in his 2013 win. Analysts have suggested a high turnout will aid Rouhani in securing a second four-year term.