New York (AFP) - Tehran will work to free three Americans from its prisons if the United States releases jailed Iranians, President Hassan Rouhani said Sunday.

"If the Americans take the appropriate steps and set them free, certainly the right environment will be open and the right circumstances will be created for us to do everything within our power and our purview to bring about the swiftest freedom for the Americans held in Iran as well," Rouhani, who is visiting New York for the UN General Assembly, told CNN.

At least three Americans, all of them of Iranian heritage, are in jail in Iran including Jason Rezaian, a correspondent for The Washington Post who was arrested in July 2014 and accused of spying.

The two other Americans are Amir Hekmati, a former US Marine who was charged with spying, and Saeed Abedini, a convert to Christianity who gathered a Bible study group.

Much of Iran's judiciary is known for its closeness to hardliners, who are eager to scuttle the moderate Rouhani's efforts to reconcile with Western powers.

"Nothing would make me happier" than movements to release prisoners, Rouhani said.

The United States has regularly demanded the unconditional release of the three prisoners.

Secretary of State John Kerry, asked by reporters about Rouhani's remarks, said he has "yet to hear directly" from Iran on the idea.

"We've had some conversations but we'll wait and see where we are," he said.

For its part, Iran has sought the freedom of 19 of its citizens who are jailed in the United States in connection with Washington's sanctions against the Islamic republic's nuclear program.

Under Rouhani, Iran has reached an agreement with the United States and five other powers to end suspicious nuclear activity in return for sanctions relief.

While tensions have eased, Iran and the United States have not had diplomatic relations since 1980, a year after the Islamic revolution toppled the Western-oriented shah.

Another American, former FBI agent Robert Levinson, disappeared in Iran in 2007 but his whereabouts are unclear.