Tehran, Iran (CNN) Incumbent Hassan Rouhani leads in early vote counting in Iran's presidential race, with a big lead over his conservative rival, Ebrahim Raisi.

Preliminary results put Rouhani ahead with 14 million votes. Raisi is second with 10 million votes.

More than 40 million Iranian voters flocked to polling stations Friday, and by Saturday morning more than 25 million votes had been counted, according to the head of Iran's Interior Ministry State Elections Committee.

Rouhani, considered a moderate, was a key architect of the 2015 nuclear deal with the US, the EU and other partners. The election is seen, at least in part, as a referendum on that agreement, which has so far yielded mixed economic results for Iranians.

His closest opponent is conservative cleric Raisi, who has cast doubt on the benefits of the nuclear deal.

Some polling stations remained open as late as midnight local time (3:30 p.m. ET) because of high voter turnout, Iran's Ministry of Interior said. CNN journalists in Tehran reported seeing long lines as voters apparently heeded calls for a big turnout.

Iran's Supreme Leader Grand Ayatollah Ali Khamenei was among the first to cast his ballot and urged others to do the same. "I believe that the presidential election is very important. The fate of the country is in the hands of people," he said.

The Supreme Leader opens the voting day, at his office compound in Tehran. A post shared by Mick Krever (@mickbk) on May 18, 2017 at 9:48pm PDT

Raisi is widely seen as Khamenei's preferred candidate -- indeed, he is often mentioned as his possible successor.

Iranian President Hassan Rouhani casts his vote in the 2017 election.

For many in Iran, especially in affluent areas of the capital, Tehran, Rouhani has provided a glimpse of what many have long desired -- engagement with the outside world, without the types of banking and visa restrictions, as well as economic sanctions -- that left them feeling so isolated.

Reform-minded supporters recognize that Rouhani isn't perfect -- he too, after all, is also a cleric. But he's widely seen by reformers as their best hope for change.

Iranians queue to cast their ballots in presidential elections in Tehran on May 19, 2017.

A CNN crew in north Tehran, where there are a lot of moderate Rouhani supporters, saw long lines all day at one polling station, with some people waiting up to three hours to vote despite the scorching heat.

Voter Mahya Kamalvan, 26, told CNN: "We cannot complain if someone else is chosen. We have to prove that we are here, we support what we want. And then if anything happens the other way, maybe we can say something."

Medical student Yasaman Allahgholy, 22, waits to vote in North Tehran on Friday.

Another voter, 22-year-old medical student Yasaman Allahgholy, said it was her duty to vote to "make my country more free, and be more popular in the world," and that it was important to protect the real improvements she has seen recently in Iran's medical system.

"I am young, and I want to live in a more free country. To show what I think without fearing from being in jail or something like that," she said.

"When we fight with other countries, when we show an angry face to other countries, our economy will decrease little by little. So it's really important for me to participate in this election, for my future."

"It's the reason why I have [waited] about one hour in this line, in this hot weather."

Conservative frontrunner

Should Raisi win, Iran is expected to retreat from the kind of nascent international engagement seen during Rouhani's first term, with a focus on growing its economy internally rather than looking for direct foreign investment.

Raisi's history may deter some voters -- the 56-year-old cleric was a member of the so-called "Death Commission," which presided over the summary executions of thousands of political prisoners in the summer of 1988.

But Rouhani won't necessarily benefit.

Iranians queue to cast their votes at a polling station in Tehran.

Ahmad Majidyar, who leads the IranObserved Project at the Middle East Institute, believes that "many reformists are dismayed by the President's unwillingness to stand up to the country's judiciary and security establishment," meaning many may simply not bother to vote at all.

In a tight contest, a traditionally high turnout among conservatives could be enough to give Raisi victory.

Massive turnout at rally for Iranian conservative presidential candidate Ebrahim Raisi. Election is on Friday. Pollster say too close to call. #cnn #iran A post shared by Fred Pleitgen (@fpleitgencnn) on May 16, 2017 at 7:06am PDT

However, Rouhani has history on his side: no sitting president has failed to win a second term since 1981.

Official results, which will be announced by Iran's Ministry of Interior, are not expected until later this weekend. If no one candidate achieves an absolute majority -- over 50% of the vote -- a runoff will take place on May 26.

The key issues

The President has had a tough time defending the 2015 nuclear deal and his opponents have accused him of not making good on his promises. Debates have largely centered on this issue.

Rouhani billed the deal as one that would thrust open the gates of economic opportunity, bring the country out of its isolation and create millions of jobs for Iranians.

JUST WATCHED What's life like inside Iran? Replay More Videos ... MUST WATCH What's life like inside Iran? 01:28

The agreement has brought a string of billion dollar deals with Western firms for airplanes and oil exploration in Iran.

But the benefits have been largely limited by a fall in global oil prices and US President Donald Trump's election, which introduced uncertainty for investors -- Trump has repeatedly threatened to rip up the deal. For the average Iranian, the results have been lackluster, and Raisi has jumped upon this accusing Rouhani of sacrificing Iran's sovereignty for a fool's bargain.

Unemployment remains high -- although it fell during Rouhani's first term -- and growth is middling.

The official unemployment rate is 12.5%, and much higher for the university-educated. But since the Iranian government counts anyone who works just one hour a week as employed, according to Hamed Mousavi of Tehran University, the true overall number is likely well over 20%.

Rouhani stated the choice facing Iranians simply: "Our nation will announce if it continues on the path of peacefulness, or if it wants to choose tension."

Voter Hassan Rahmani in North Tehran says Iran's growth depends on good international relations.

For voter Hassan Rahmani, 34, in northern Tehran, maintaining good relations is key to Iran's future.

"All the growth in this country is dependent on relations with the other countries -- European countries, United States, all the countries," he told CNN.

Ershan Nasroudi, 35, voiced a similar view. "We see that if you want to have a safe economy, if you want to have a better life for the people, you have to have relations with other countries," he said.

Vibrant scenes

In Iran, where political speech is severely curtailed, newspapers and even social media channels are government regulated and protest comes with great personal risk, the quadrennial presidential election is an opportunity to blow off emotional steam, to act politically in the most public, and loud, of ways.

At a campaign rally last week at the Azadi stadium in Tehran, Rouhani took to the stage and delivered a speech more worthy of an outsider than the incumbent.

Standing behind a lectern and surveying the sea of purple -- his campaign color -- before him, Rouhani promised much.

"We want freedom of the press," he declared. "Freedom of association, and freedom of thought!"

However, his supporters will be aware that even if re-elected, what Rouhani can achieve may be limited by the authority wielded by Iran's Supreme Leader Khamenei, and by institutions such as the Revolutionary Guards.