The US president, in an interview aired Sunday, publicly confirmed the outreach to Rouhani for the first time, and said he believed the Syria chemical arms drama showed that diplomacy could work if backed by threats of military action.
In the interview, Obama claimed that the outcome of the Syrian deal offered Iran a "lesson" in the benefits of diplomacy.
Obama was asked on the ABC News "This Week" program whether he had reached out to Rouhani who was elected in June.
"I have. And he's reached out to me. We haven't spoken-- directly," Obama said.
Asked by interviewer George Stephanopoulos whether the contact was via letters, Obama replied: "Yes."
"I think what the Iranians understand is that -- the nuclear issue -- is a far larger issue for us than the chemical weapons issue," Obama said.
"The threat against ... Israel, that a nuclear Iran poses, is much closer to our core interests.
"A nuclear arms race in the region-- is something that would be profoundly destabilizing.
"My suspicion is that the Iranians recognize they shouldn't draw a lesson -- that we haven't struck (Syria) -- to think we won't strike Iran."
Obama said that on the other hand, the lesson from the showdown over Syria's chemical weapons should indicate that "there is the potential of resolving these issues diplomatically."
Obama's letter to Rouhani had been reported in the regional media though was not publicly confirmed by the White House.
Rouhani last week warned that Tehran will not give up "one iota" of its nuclear rights and said the time for negotiation was limited.
He spoke ahead of a meeting later this month between Foreign Minister Mohammad Javad Zarif and EU foreign policy chief Catherine Ashton on restarting negotiations on Iran’s nuclear program.
On September 5, President Rouhani officially assigned the Foreign Ministry to take charge of future nuclear talks with the P5+1 group -- Britain, China, France, Russia, and the United States plus Germany.
The United States, Israel and some of their allies falsely claim that Iran is pursuing non-civilian objectives in its nuclear energy program, with the US and the European Union using the unfounded allegation as a pretext to impose illegal sanctions on Iran.
Tehran strongly rejects the claim, maintaining that as a committed signatory to the Non-Proliferation Treaty and a member of the IAEA, it has the right to use nuclear technology for peaceful purposes.
HH/HH