UPDATE 5-Trump, Iran's president talk of possible meeting to solve nuclear impasse

* Rouhani willing to meet Trump, Macron says

* Trump says Iran is country of "tremendous potential"

* Iran "hurting badly" under sanctions, Trump says

* Khamenei, not Rouhani, is Iran’s top leader (Adds analysts' comments, paragraphs 11, 21-24)

By John Irish and Michel Rose

BIARRITZ, France, Aug 26 (Reuters) - U.S. President Donald Trump said on Monday he would meet Iran's president under the right circumstances to end a confrontation over a 2015 nuclear deal and that talks were underway to see how countries could open credit lines to keep Iran's economy afloat.

But Trump, speaking at a G7 summit in the French resort of Biarritz, ruled out lifting economic sanctions to compensate for losses suffered by Iran.

Trump told reporters it was realistic to envisage a meeting between him and President Hassan Rouhani in coming weeks, describing Iran as a country of "tremendous potential".

"I have a good feeling. I think he (Rouhani) is going to want to meet and get their situation straightened out. They are hurting badly," Trump said.

French President Emmanuel Macron, host of the G7 summit, told the same news conference that Rouhani told him he would be open to meeting Trump. Macron said he hoped a summit between the two could happen in coming weeks. Trump and Rouhani head to the United Nations General Assembly in September.

Anything agreed at a Trump-Rouhani encounter would be subject to approval by Iran's top decision maker, the fiercely anti-American Supreme Leader Ayatollah Ali Khamenei.

European leaders have struggled to calm the deepening confrontation between Tehran and Washington since Trump pulled out of the 2015 nuclear deal and reimposed sanctions on Iran. Macron has spent the summer trying to create conditions that would bring the sides back to the negotiating table.

"What I hope is that in coming weeks, based on these talks, we can manage to see a summit between President Rouhani and President Trump," Macron said, adding he believed if they met a deal could be struck.

Macron's efforts took a surprise turn on Sunday when Iranian Foreign Minister Mohammad Javad Zarif, who is under U.S. sanctions, flew to Biarritz.

Some experts expressed skepticism that Rouhani would meet Trump without at least a suspension in U.S. sanctions aimed at slashing Iran’s oil exports – Tehran’s main source of revenue – to zero. But one said Macron's plan appeared to include financial relief for Tehran that does not involve relaxing U.S. sanctions.

"VERY VIOLENT FORCE"

Iran has recently engaged in combative rhetoric about its ability to attack U.S. interests. Trump said: "They can’t do what they were saying they were going to do because if they do that, they will be met with really very violent force. So I think they are going to be good."

Trump said he was not open to giving Iran compensation for sanctions. However he said the idea under discussion would be for numerous countries to give Iran a credit line.

"No we are not paying, we don't pay," Trump said.

"But they may need some money to get them over a very rough patch and if they do need money, and it would be secured by oil, which to me is great security, and they have a lot of oil... so we are really talking about a letter of credit. It would be from numerous countries, numerous countries."

The 2015 deal between Iran and six world powers, reached under former U.S. President Barack Obama, aimed to curb Iran's disputed uranium enrichment programme in exchange for the lifting of many international sanctions on Tehran.

Since ditching the deal last year, Trump has pursued a policy of "maximum pressure" to try to force Iran into broader talks to restrict its ballistic missile programme and end its support for proxy forces around the Middle East.

During his brief visit on Sunday, Zarif held talks with Macron and British and German officials before returning home.

Though potentially a diplomatic minefield, Macron's gamble with Zarif appears to have worked out for now, as Trump endorsed the initiative and toned down his rhetoric on Tehran.

Richard Nephew, who served on the Obama administration team that negotiated the nuclear deal, said it was unlikely Rouhani would meet Trump unless U.S. sanctions were eased.

“I think even a photo and a handshake would be too hard for Rouhani unless immediately after there was a suspension in sanctions,” said Nephew, a scholar at Columbia University and the Brookings Institution think tank .

Pointing to Trump’s reference to Iran receiving a line of credit, Jon Alterman, a former State Department official, said it appeared that Macron's plan involved financial help for Tehran.

But whether a Trump-Rouhani meeting goes forward could depend on whether Iran, which slowly has been breaching the nuclear deal, proceeds with a threat of further violations in early September unless it receives sanctions relief, said Alterman, director of the Middle East Program at the Center for Strategic and International Security think tank.

"MAKE IRAN RICH AGAIN"

While Trump reaffirmed Washington's goal of extracting further-reaching security concessions from Iran, he said he wanted to see "a really good Iran, really strong", adding that Washington was not looking for regime change.

"I knew (Zarif) was coming in and I respected the fact that he was coming in. We're looking to make Iran rich again, let them be rich, let them do well, if they want," Trump said.

While Trump's European allies also want fresh negotiations, they believe the nuclear deal must be upheld to help ward off the risk of wider war in the Middle East. Macron had already met Zarif in Paris on Friday ahead of the G7 summit.

"What we want is very simple. It's got to be non-nuclear (as well)," Trump said. "We're going to talk about ballistic missiles..., about the timing. But they (Iran) have to stop terrorism. I think they are going to change, I really do."

Trump said it was too early for him to meet Zarif himself.

Rouhani signalled a readiness to meet Trump if that helped Iran, according to the official presidency website.

"If I know that in meeting with somebody the problem of my country would be solved, I wouldn’t hesitate because the central issue is the national interests of the country," Rouhani said. (Additional reporting by Jeff Mason, Marine Pennetier, and Babak Dehghanpisheh in Geneva, and Jonathan Landay in Washington Writing by John Irish Editing by William Maclean and Gareth Jones)

Advertisement