Canadian Prime Minister Justin Trudeau, second from left, German Chancellor Angela Merkel, left, President of France Emmanuel Macron, second from right, and British Prime Minister Boris Johnson take part in a working session with G7 leaders on the second day of the G-7 summit in Biarritz, France Sunday, Aug. 25, 2019. (Sean Kilpatrick - The Canadian Press via AP)

BIARRITZ, France (AP) — A top Iranian official paid an unannounced visit Sunday to the G-7 summit and headed straight toward the heart of the city where leaders of the world's major democracies have been debating how to handle the country's nuclear ambitions.

France's surprise invitation of Iranian Foreign Minister Mohammad Javad Zarif was a high-stakes gamble for French President Emmanuel Macron, who is the host of the Group of Seven gathering in Biarritz.

Zarif spent about five hours in Biarritz after his plane touched down at the airport, which has been closed since Friday to all flights unrelated to the official G-7 delegations.

A senior French official, speaking on condition of anonymity to discuss the sensitive talks, said Macron personally informed U.S. President Donald Trump about the invitation to Zarif.

The official noted that Macron and Trump met for two hours Saturday and discussed Iran at length, as well as at the informal group dinner Saturday night.

Another French official said that France "is working in full transparency with the U.S. and in full transparency with European partners." The Iranian met with Macron as well as diplomats from France, Germany and Britain at the Biarritz city hall, the official said.

Zarif, who is under U.S. sanctions, had been scheduled to go to Asia as part of a tour to seek support for Iran amid the American campaign against it since Trump withdrew the U.S. from Tehran's 2015 nuclear deal.

U.S. Treasury Secretary Steve Mnuchin said Trump had not "set preconditions" on negotiations with Iran.

Zarif arrived as fissures emerged among G-7 leaders over how to deal with Iran.

Macron said the leaders agreed during a dinner the night before that the French president could serve as a G-7 messenger to Iran. Trump denied agreeing to anything, and Macron was forced to play down his role and acknowledge Trump's status as "the president of the world's number one power."

The French official also said that based on Saturday night's dinner, France considers it important to check in with Zarif to continue to bring positions closer together and ease tensions. The official said the French are not "mediators" but think they can contribute to de-escalation.

Macron said he has no formal mandate to speak for the G-7 leaders in delivering a message to Iran, but that he would be able to address the issue in the context of what they agreed to during the dinner.

For several months, Macron has taken a lead role in trying to save the 2015 nuclear accord, which has been unraveling since Trump pulled the U.S. out of the agreement. His office said the G-7 leaders agreed he should serve as a go-between with Iran.

"I haven't discussed that," Trump said Sunday morning. He described the dinner as "very, very good" and blamed the media for anything that implied otherwise.

But it seemed from other accounts that the dinner had been tense, with a clear divide between him and the rest of the G-7.

British Prime Minister Boris Johnson, greeting Macron for a morning meeting, congratulated the French president and shook his hand.

"Well done. Bien joué," Johnson said, using the French expression for "well played" often uttered in a successful round of cards.

"You did very well last night. My God that was a difficult one. You did brilliant," he added.

Tristen Naylor, deputy director of the G7 Research Group, described the invitation as "a wild-card move."

"The risks to the French president were quite large. He could have evoked a very strong and negative reaction from the American president — everything from outright condemnation to actually the American president just saying enough of this and getting on the plane and flying away," Naylor said.

But the invitation was also something of a mirror of Trump's own high-stakes diplomacy.

"Something that we've learned over the 2 ½ years about the American president is that what works with him, what resonates with him, is surprise, is a big move, something flashy," he said. "And the French president has taken a page from it, I think, executed a maneuver out of it with great aplomb."

German Chancellor Angela Merkel said Zarif's presence was parallel to any G-7 events and that everyone agreed to seek more talks rather than tensions.

She added: "It is absolutely right to explore every possibility, and what we discussed yesterday — which wasn't a formal assignment for anyone. But Iran certainly should know what we discussed."

After Zarif left, Macron and Trump had several apparently friendly exchanges as they prepped for the group photo of the leaders.

"Maybe Macron jumped the gun and misinterpreted. But we haven't been hearing howls of fury from the American delegation. It wouldn't be surprising if this is something which was, if not green-lighted, then not red-lighted by Washington," said Francois Heisbourg, adviser at the London-based International Institute for Strategic Studies and at the Paris-based Foundation for Strategic Research. "This may not be the best of ideas from Washington's standpoint. But it doesn't hurt the Americans."

The G-7 leaders focused much of Sunday on what they can do to boost growth at a time of heightened uncertainty. Manufacturers around the world are smarting from the trade dispute between the U.S. and China , which has led to new import taxes on hundreds of billions of dollars-worth of goods. Businesses don't know where tariffs will be imposed next.

The White House had said putting the economy on the agenda was Trump's idea, but the G-7 has for over four decades always included a focus on the economy. It was founded as a response to the Arab oil embargo in the 1970s and the recession that followed.

The backdrop is particularly worrying this year, with the U.S. economy slowing and Germany and Italy close to recession.

Meanwhile, Britain is due to leave the EU in October, and there is no agreement on how it should happen, raising the possibility of a disorderly exit that could wreak havoc for business in Europe.

Johnson said Britain and Europe needed to prepare for that, saying the prospect of a Brexit deal was "touch and go."

The G-7 summit includes the heads of Britain, France, Germany, Japan, Canada and Italy as well as a representative of the 28-country EU.

In the nearby town of Bayonne, protesters demanded Macron do more to protect French workers and the planet.

A mix of activists, some wearing yellow vests, carried portraits of the French president as they marched Sunday in solidarity with environmental activists who removed official portraits of Macron from town halls around France earlier this year to protest his climate change policies.

Internationally, Macron is a vocal champion of fighting climate change and has challenged Trump on the issue. At home in France, however, activists accuse him of lagging on promises to wean France from fossil fuels.

___

Associated Press writers Nasser Karimi in Tehran, Iran; Geir Moulson in Berlin; Angela Charlton in Paris; and Zeke Miller and David McHugh in Biarritz contributed to this report.

Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.