President Hassan Rouhani defended his efforts to improve Iran's economy and hit out at his hardline opponents in a final televised debate on Friday against challengers who aim to topple him in an increasingly acrimonious election next week.

Rouhani, swept into office in a landslide four years ago on promises to reduce Iran's international isolation, is seeking a second term after negotiating an agreement with world powers to curb Iran's nuclear programme in return for lifting sanctions.

"If we want a better economy, we should not let groups with security and political backing to get involved in the economy," Rouhani said during the debate, in an unmistakable swipe at the Revolutionary Guards Corps, an elite military force with a vast business empire, which has backed his main hardline opponent Ebrahim Raisi.

"Mr Raisi, you can slander me as much you wish. As a judge of the clerical court, you can even issue an arrest order. But please don't abuse religion for power," Rouhani said at one point.

"Some security and revolutionary groups are busing people to your campaign rallies ... Who finances them?" he said at another point.

He cast his other main rival, Tehran Mayor Mohammad Bagher Ghalibaf, a former Guards commander and police chief, as a thug who had boasted of personally taking on young demonstrators.

"You wanted to beat up students," Rouhani said.

Normally measured in his public speeches, Rouhani has become increasingly forceful in recent days, giving voice to the grievances of reformers who say they have been oppressed since the 1979 Islamic Revolution by security forces like the guards.

"I am surprised. Those of you who talk about freedom of speech these days ... [you are] those who cut out tongues and sewed mouths shut," Rouhani told a rally on Monday in a thinly veiled attack on Raisi, a former jurist involved in mass executions of political prisoners in the 1980s.

"Our people want political and social freedom ... In the election they will not vote for those who knew only executions and prison for 38 years," Rouhani said in a rally on Tuesday.

He faces five challengers led by Raisi and Ghalibaf, who both say Rouhani has sold Iran's interests too cheaply to the West and allowed the economy to decay through mismanagement.

The first round is on 19 May, with a run-off a week later if no candidate wins more than 50 percent of the vote.

Although Iran's political system puts ultimate power in the hands of an unelected supreme leader, and all candidates are vetted by a hardline watchdog body, elections are nevertheless hard-fought contests that can bring dramatic change.

As in two earlier, bruising debates, the main challengers tore into Rouhani's economic record, arguing that he failed to bring Iranians a better life despite the lifting of sanctions.

Raisi described a litany of poor economic performance under Rouhani, saying 250,000 small businesses had shut and cash payments to the poor should be raised: "Unemployment is high. People's purchasing power has dropped dramatically," he said.

Rouhani's biggest worry is that some of the voters who carried him to a single-round victory in 2013 will stay home, disillusioned that the lifting of sanctions has brought few economic benefits and the pace of social change has been slow.

"Rouhani is trying to reach out to voters who guaranteed his election four years ago by hoping to have a freer Iran," said a former official close to Rouhani's government.

Rouhani's deal to lift sanctions won the cautious backing of Supreme Leader Ayatollah Ali Khamenei, but Khamenei and his hardline loyalists criticise its failure to boost the economy. Benefits have been slow to arrive, in part because of unilateral US sanctions still in place on Iran's missile programme, human rights record and allegations it supports terrorism.

Rouhani's allies say the hardliners oppose deeper change and exposure to international competition in part because of the economic interests of the Guards, which gained control of swathes of Iran's industry during its years of isolation.

'Crossing red lines'

Although Rouhani won more than three times as many votes as his closest challenger four years ago, he only narrowly avoided a second round with just over half the total votes. If he sheds just a bit of that support now, he could face a dangerous second round against a single opponent who unites the hardline faction.

"I wanted to boycott this election because I am so disappointed with Rouhani's failure to bring more freedom to Iran," said teacher Reza Mirsadegh in the central city of Yazd.

"But I have changed my mind. I will vote for Rouhani to prevent Raisi's win."

Iran's ultimate authority Khamenei has warned the public against protests like those that broke out after the disputed election of 2009, when reformers disputed the victory of hardliner Mahmoud Ahmadinejad.

"Those who deviate from this path will be slapped in the face," Khamenei said in a televised speech on Wednesday. The guards, their affiliated volunteer Basij militia and many Friday prayer leaders have thrown their support behind Raisi, a veteran jurist whose name has also been mentioned as a future supreme leader.

Ghalibaf, a former guards commander, lacks Raisi's backing from the clerical establishment but also has millions of supporters for a hardline message on security and a populist economic platform.

He has made a run-off more likely by resisting calls from other hardliners to step aside. Rouhani, meanwhile, has crossed traditional red lines in his rallies by openly criticising the security forces and judiciary, trying to fire the enthusiasm of reformist voters.

"Those who over the past years only imposed bans ... please don’t even breathe the word freedom for it shames freedom," Rouhani said in a rally in the city of Hamedan.