Iran's supreme leader Ayatollah Ali Khamenei said Wednesday that the outgoing government's experience of engaging with world powers including the United States shows that "trusting the West does not work".

President Hassan Rouhani's signature diplomatic achievement, a 2015 nuclear deal with major powers, gave Iran some relief from international sanctions in exchange for limits on its nuclear programme.

But it was torpedoed in 2018 by then US president Donald Trump, who unilaterally withdrew from the agreement and reimposed punishing sanctions.

"Future generations should use this experience. It was made clear during this government that trusting the West does not work," Khamenei told outgoing President Hassan Rouhani and members of his cabinet.

Rouhani's government has been holding talks with major powers since April on bringing Washington back into the agreement, but a deal now seems unlikely until after he hands over to President-elect Ebrahim Raisi next month.

Khamenei said Washington has conditioned its return to the 2015 deal on including "a sentence ... that (says) some issues be talked about in the future, or we will have no agreement".

"With that sentence, they want to have an excuse for their next meddlings with the (deal) itself -- missiles and regional issues," his official website quoted him as saying.

One of the major criticisms of the 2015 deal raised by Trump was its failure to address Iran's ballistic missile programme or its alleged interference in regional affairs.

Iran's supreme leader Ayatollah Ali Khamenei sums up the lessons learned in an address to the outgoing government of President Hassan Rouhani
Iran's supreme leader Ayatollah Ali Khamenei sums up the lessons learned in an address to the outgoing government of President Hassan Rouhani KHAMENEI.IR / -

But Tehran has always rejected bringing non-nuclear issues into the agreement, which is known formally as the Joint Comprehensive Plan of Action.

Khamenei also criticised the US for refusing to "guarantee that (it) will not violate the agreement in the future" by plling out unilaterally, as Trump did in 2018.

"Whenever you postponed issues with agreements with the West or negotiations with the West and America and the like, you were stuck and could not progress," he told the Rouhani government.

"Because they don't help. They are the enemy after all."

Trump's successor Joe Biden has signalled his readiness to return to the nuclear deal and has engaged in indirect negotiations with Iran alongside formal talks with the agreement's remaining parties, Britain, China, France, Germany and Russia.

Rouhani's successor Raisi is an ultra-conservative but has expressed support for the nuclear talks arguing that Iran needs an end to US sanctions.

Iran's ultraconservative camp, which deeply distrusts the United States, has repeatedly criticised Rouhani over the 2015 deal.

Raisi has said that his government will support talks that "guarantee national interests", but will not allow negotiations for the sake of negotiations.