BIARRITZ, France — He was not on the original invitation list, but when a plane landed in Biarritz on Sunday bringing Iran’s foreign minister to the city hosting President Trump and other world leaders, it got everyone’s attention.

The surprise guest, Mohammad Javad Zarif, flew to the resort town in southern France on a last-minute invitation from President Emmanuel Macron of France, the host of the annual Group of 7 summit meeting, who has been trying to reconcile the United States and Iran.

Mr. Zarif was meeting with France’s foreign minister, Jean-Yves Le Drian, and not invited to attend any of the formal Group of 7 sessions, nor was he to meet with any American officials while here, according to French and Iranian officials. But his presence was an unexpected twist in a conflict that has escalated in recent months with a string of episodes involving tankers and drones near Iran.

A senior French official insisted that Mr. Trump was given advance warning. Treasury Secretary Steven Mnuchin, speaking with reporters, would not discuss Mr. Zarif’s visit, but did make a point of repeating Mr. Trump’s occasional expressions of willingness to talk with Tehran.