TEHRAN, Iran (AP) — Iran’s President Hassan Rouhani won re-election by a wide margin Saturday, giving the moderate cleric a second four-year term to see out his agenda pushing for greater freedoms and outreach to the wider world.

The 68-year-old incumbent secured a commanding lead of 57 percent in a race that drew more than seven out of every 10 voters to the polls. His nearest rival in the four-man race, hard-liner Ebrahim Raisi, secured 38 percent of the vote.

As Rouhani appeared close to victory, some female drivers held out the V for victory sign and flashed their car lights on highways in Tehran’s affluent north.

“We made the victory again. We sent back Raisi to Mashhad,” his conservative hometown in northeastern Iran, said Narges, a 43 year-old beauty salon owner, who declined to give her full name. She said she spent more than three hours outside waiting to vote, “but it was worth it.”

Interior Minister Abdolreza Rahmani Fazli announced the vote tallies in a televised news conference, based on a count of more than 99 percent of the ballots. He said Rouhani garnered 23.5 million votes out of 41.2 million ballots cast. Iran has 56.4 million eligible voters.

In 2013, Rouhani won the presidential election with nearly 51 percent of the vote. Turnout for that vote was 73 percent.

Iran’s president is the second-most powerful figure within Iran’s political system. He is subordinate to the supreme leader, who is chosen by a clerical panel and has the ultimate say over all matters of state.

Election officials repeatedly extended voting hours until midnight to accommodate long lines of voters, some of whom said they waited hours to cast their ballots. Analysts have said a higher turnout would likely benefit Rouhani.

Friday’s vote was largely a referendum on Rouhani’s more moderate political policies, which paved the way for the landmark 2015 nuclear deal that won Iran relief from some sanctions in exchange for curbs on its nuclear program.

Rouhani has come to embody more liberal and reform-minded Iranians’ hopes for greater freedoms and openness at home, and better relations with the outside world.

Raisi, his nearest challenger, is close to Ayatollah Ali Khamenei, Iran’s supreme leader, who stopped short of endorsing anyone in the election. Raisi ran a populist campaign, vowing to fight corruption and fix the economy while boosting welfare payments to the poor.

Many of Raisi’s critics pointed to his alleged role condemning inmates to death during Iran’s 1988 mass execution of thousands of political prisoners, and feared a victory for the hard-liner could worsen human rights in Iran and put the country on a more confrontational path with the West.

The two other candidates left in the race, Mostafa Mirsalim, a former culture minister, and Mostafa Hashemitaba, a pro-reform figure who previously ran for president in 2001, respectively have 478,000 and 215,000 votes each.

Hashemitaba was among the first to predict an outright win for Rouhani as he offered his congratulations Saturday morning.

“Rouhani will apply his ever-increasing efforts for the dignity of Iran” in his next term, the reformist said.

The Tehran Stock Exchange rallied after the election results came out, extending a recent winning streak to close nearly 1 percent higher at its highest level in three months.

Although considered a moderate by Iranian standards, Rouhani was nonetheless the favorite pick for those seeking more liberal reforms in the conservative Islamic Republic.

He appeared to embrace a more reform-minded role during the campaign as he openly criticized hard-liners and Iran’s powerful Revolutionary Guard, a paramilitary force involved in the war in Syria and the fight against Islamic State militants in neighboring Iraq.

That gave hope to his supporters, who during recent campaign rallies called for the release of two reformist leaders of the 2009 Green Movement who remain under house arrest. The two figures, Mir Hossein Mousavi and Mahdi Karroubi, both endorsed Raisi, as did Mohammad Khatami, another reformist who served as Iran’s president from 1997 to 2005.

Iran has no credible political polling to serve as harder metrics for the street buzz around candidates, who need more than 50 percent of the vote to seal victory and avoid a runoff. But what scant data that was available before the vote showed Rouhani in the lead.

The position of president is a powerful post. He oversees a vast state bureaucracy employing more than 2 million people, is charged with naming Cabinet members and other officials to key posts, and plays a significant role in shaping both domestic and foreign policy.

All candidates for elected office must be vetted, a process that excludes anyone calling for radical change, along with most reformists. No woman has ever been approved to run for president.

Ahmadi said the Interior Ministry expects to announce final results later Saturday.

___

Associated Press writers Amir Vahdat in Tehran and Jon Gambrell contributed reporting from Dubai, United Arab Emirates.