By Jon Hemming

DUBAI (Reuters) - Campaigning in Iran's presidential election ended on Thursday, a day before the vote in which the sole moderate candidate has an outside chance of stealing victory from his hardline rivals.

Hardliners have failed to agree on a unity candidate, potentially splitting their vote and improving the chances of moderate cleric Hassan Rohani to progress to a run-off poll.

The next president is not expected to produce any major policy shift on Iran's disputed nuclear program or its support for Syrian President Bashar al-Assad, since Supreme Leader Ayatollah Ali Khamenei calls all the shots on big issues.

Yet all but one of the candidates - chief nuclear negotiator Saeed Jalili - has advocated a less intransigent approach to nuclear talks with world powers. The president can influence the tone of Iran's foreign policy with his choice of trips abroad. Khamenei, 73, never travels outside Iran.

Friday's presidential election is the first in Iran since 2009 when reformists said the vote had been rigged to ensure the re-election of Mahmoud Ahmadinejad, touching off the biggest protests since the 1979 Islamic revolution.

Khamenei is determined to see a less troublesome, more compliant president, analysts say, but above all no repeat of the 2009 unrest that dented the Islamic Republic's legitimacy.

Consequently, campaigning, which ended at 8 a.m. local time on Thursday, has been tightly restricted and subdued.

But Rohani appeared to be showing a last-minute surge with large crowds on the streets of the eastern holy city of Mashhad for his final election gathering on Wednesday.

"Rohani was amazing in yesterday's rally. It was a huge welcome and unprecedented in Mashhad," wrote one supporter on Twitter.

Pictures on social media showed what appeared to be sizeable public rallies, discouraged by authorities, in favor of Rohani in Tehran late into the night. Large rallies were also staged in the Iranian capital by supporters of hardline candidates.

Rohani, best known for his conciliatory stance in nuclear talks with Western powers between 2003 and 2005, could benefit from his rivals' failure to unite behind a single hardline candidate despite months of trying.

HARDLINERS DIVIDED

Of the three main hardliners standing, Jalili has run a strong campaign, but has been heavily criticized, even by fellow hardliners, for his intransigence in nuclear talks and for failing to stop the imposition of tough new sanctions.

He is alone among the candidates in defending Iran's robust, ideologically-driven foreign policy.

The other main conservative candidates, while not necessarily disagreeing with the substance of Iran's present policies, have emphasized what they say will be their more inclusive domestic policies and more pragmatic style abroad.

Ali Akbar Velayati, a former foreign minister and adviser to Khamenei, has pledged to consult widely before taking decisions.

Mohammad Baqer Qalibaf has campaigned on his record as current Tehran mayor and may attract votes in the capital where residents recognize him as a competent administrator who has not attempted to make unpopular inroads into people's private lives.

He also pledged to unite the country if he were elected.

"Friday should turn into the day when all differences end," the Fars news agency quoted him as saying. "I also hope that, by choosing the most appropriate president, Friday would also be the day to end all oppression, lies and hypocrisy."

All the candidates have blamed mismanagement by Ahmadinejad for fuelling inflation and adding to the economic woes caused by tightening international sanctions, but none have given specific details of what they intend to do to solve the problem.

Despite his endorsement by reformists sidelined after 2009, Rohani is still very much an establishment figure, though one less dogmatic and more open to conciliation with the West.

In an interview with the Arabic newspaper Sharq Al Awsat published on Thursday, Rohani said Israel was behind a campaign of disinformation to label Tehran's peaceful nuclear activities a weapons program.

"The United States and its allies have to stop this deceit," Rohani told the Saudi-owned newspaper. He would judge U.S. President Barack Obama "by his actions, not his words" and called for sanctions to be lifted in order for ties to improve.

A high voter turnout might benefit Rohani, but more liberal Iranians likely to back the mid-ranking cleric are debating whether to vote at all, given their widespread belief that the result will be fixed as they say it was in 2009.

Some middle-class Iranians though, while not enthused about any of the candidates, may vote to try to stop a hardliner such as Jalili getting in.

"Up to today I had no intention of voting. I couldn't bring myself to, but now to anyone who asks, I say if I vote, I will vote for Rohani," wrote another Iranian on Twitter.

With no independent, reliable opinion polls in Iran, it is hard to gauge the public mood, let alone the extent to which Khamenei and the powerful Revolutionary Guards will exert their influence over the ballot.