The US president stresses any co-operation on fighting IS is contingent on Iran reaching such an agreement by a 24 November diplomatic deadline.

The White House has declined to comment on Mr Obama's "private correspondence".

But Republican senators John McCain and Lindsey Graham said it was "outrageous" that the president would approach Iran, given its support for the Syrian government and Shia groups such as Lebanon's Hezbollah.

"The administration needs to understand that this Iranian regime cares more about trying to weaken America and push us out of the Middle East than cooperating with us," they said in a joint statement.

"The consequences of this ill-conceived bargain would destroy the Syrians' last, best chance to live in freedom from the brutal Assad regime."

Image copyrightAPImage caption
Supreme Leader Ayatollah Ali Khamenei has until 24 November to sign to an international nuclear agreement

Fourth letter

The US has ruled out inviting Iran to join an international coalition it has assembled against IS, but has said Iran has a role to play in the fight against IS.

Islamic State, a Sunni jihadist group, poses a threat to Shia-majority Iran and has taken over large parts of Iran's Shia-dominated ally Iraq.

The group's militants currently control large areas of Iraq and Syria and have carried out mass killings across the region.

But Iran's Supreme Leader Ayatollah Ali Khamenei has ruled out co-operating with the US against IS, accusing Washington of having created the jihadist group as a tool against Iran.

The letter, sent last month, is at least the fourth time Mr Obama has written to the Iranian leader since taking office in 2009 and underscores his view that Iran is important in an emerging campaign against IS.

Analysis, Kim Ghattas, BBC News

America's Arab allies are bound to be dismayed by news of the letter. Foreign diplomats said US administration officials they spoke to did not deny its existence.

And key Gulf countries who are part of the current military coalition against IS were not informed about the letter in advance, which diplomats said could undermine trust between US and its partners at a crucial moment.

When the US started secret negotiations with Iran in 2012, it did not inform countries like Saudi Arabia or Israel. They were outraged when news surfaced of the secret channel. This letter will be seen as another example of Mr Obama acting with little regard for his allies as he doggedly pursues a deal with Iran.

American officials will argue they are doing what's best in America's national security interest.

Deal or no deal?

Officials with the Obama administration have recently talked down the chances of a deal on Iran's nuclear programme, rating it at only 50-50, according to the Wall Street Journal.

US Secretary of State John Kerry is scheduled to begin negotiations on the issue with Iranian counterpart Javad Zarif this weekend in Oman.

World powers suspect Iran of trying to make a nuclear bomb, a claim it denies.

An interim deal agreed late last year gave Iran some relief from sanctions in return for curbs on nuclear activity.

But talks later stalled on the extent of uranium enrichment Iran would be allowed and on the timetable for sanctions to be lifted.

On Thursday, White House spokesman Josh Earnest declined to comment directly on the secret letter.

"I can tell you that the policy that the president and his administration have articulated about Iran remains unchanged," he said in response to questions.

Also on Thursday, Republican speaker of the House John Boehner said he did not trust Iran's leaders and said they should not be brought into the fight against IS.