Saint-Jean-de-Luz, France (CNN) Donald Trump's G7 summit, which began with trade strife and Iran discord , ended Monday with the President expressing enthusiastic optimism that a deal with China is near and the remarkable prospect he could meet in the coming weeks with his Iranian counterpart.

Whether either of those outcomes is likely or at all possible remains an open question. But the attempt to put a positive spin on an event Trump was dubious of even attending reflected at least the appearance of momentum on issues that have isolated Trump from his counterparts.

"There was tremendous unity. There was great unity," Trump said as he was preparing to depart. "I will tell you, we would have stayed for another hour. Nobody wanted to leave."

That's a cheerful assessment of the seaside gathering that was still marked by open disagreements on trade and lingering resentments over Trump's decision to withdraw from the Iran nuclear deal.

In dinners and meetings throughout the weekend, leaders confronted Trump on those issues and others. The consensus document that was produced at the end was only one-page long, and contained broad statements of agreement like a commitment to the "stability of the global economy" and a shared objective "that Iran can never acquire nuclear weapons."

Trump made little effort to disguise his differing opinions, saying at a news conference that tariffs were working and the Iran deal was "stupid."

But he sought to place those views within the realm of opinions that might be accepted by his fellow leaders, even as they expressed concern about the global consequences.

Iran meeting?

When his host, French President Emmanuel Macron, announced he was working to arrange a meeting between Trump and Iranian President Hassan Rouhani, Trump initially declined to commit to meeting, saying bad behavior from Iran would be met with "violent force."

But later he said he thought it was realistic to think such a meeting could occur.

"I think there's a really good chance that we would meet," he said.

That would reflect a momentous occasion amid increasing tensions in the Persian Gulf following Trump's decision to withdraw from the Obama-era nuclear deal. The time frame spelled out by Macron could place the encounter at the yearly United Nations General Assembly in New York.

Macron said the meeting would come as a precursor to a new nuclear agreement, one that extended the window Iran would be required to curtail its nuclear program and included limits on ballistic missiles. He said it would also include compensations for Iran -- something Trump at first said he couldn't commit to. But later, he acknowledged he would be willing to accept if it amounted to short-term loans meant to rebuild Iran's economy. That's despite repeatedly condemning his predecessor for allowing billions of dollars of capital to flow into Iran as part of the deal.

Trump said Monday that agreement was "stupid," even as Macron claimed it had forced Iran to curb its nuclear program. And while both men appeared optimistic a resolution could be reached with Iran, Macron acknowledged the details were still vague.

"A road map has sort of been set but nothing has been absolutely set in stone," he said.

It was a reflection of how far all sides are from agreeing with each other on how best to confront Iran as it increases its provocative actions in the Middle East. Speaking alongside Trump earlier, German Chancellor Angela Merkel was more frank in her assessment.

"It is, obviously, still moving as an issue," she said through a translator. "And it is slowly moving forward, but there's still a long way to go yet."

Iran was just one of a set of issues that Trump and fellow leaders hashed out over three days of meetings, meals and informal meet-ups overlooking the shimmering Bay of Biscay.

China looming large

Trump's protracted trade battle with China -- and other leaders' anxiety over a weakening global economy -- provided the summit a constant subtext, with fears the additional tariffs Trump has threatened could cause further contraction.

Macron himself said the uncertainty was dragging down the global economy. But Trump brushed off the concerns.

"Sorry, it's the way I negotiate," he said.

Still, he sought to apply positive spin to the trade war on his final day here, a turnabout after ratcheting up tensions in the lead-up to the summit.

"I think they want to make a deal very badly. I think that was elevated last night, very late in the night," Trump told reporters in France.

He was apparently cheered by comments from China's vice premier, who said China would "adopt a calm attitude" in trade negotiations. That gave Trump confidence a deal is in the offing.

"I believe it more strongly now," Trump said.

But even the optimism was colored by confusion -- a constant theme throughout this weekend. After appearing on Saturday to soften on his beloved tariffs, telling reporters he had "second thoughts" about the punishing trade war, his aides swooped in to explain he was merely stating misgivings about not applying harsher duties.

The attempts at cleanup weren't welcomed by other leaders, who were cautiously cheered to learn Trump might be rethinking his approach to global trade. Instead, Trump has argued in meetings and dinners they should join him in applying tariffs on China in an attempt to force Beijing to change some of its economic practices.

The chaos continued on Monday. Trump said his trade team received multiple phone calls overnight from Beijing expressing a desire to restart talks. But China's foreign ministry, didn't mention any phone calls in a briefing on trade. And later, Trump and Treasury Secretary Steven Mnuchin refused to elaborate on the calls' substance.

"There were discussions that went back and forth and let's just leave it at that," Mnuchin said.

Still, talk of resuming discussions with China was a hopeful moment amid otherwise bitter trade disputes at the G7, where Trump has been a man alone in his insistence that tariffs can produce a trade truce rather than rattling the global economy.

Already, US and Chinese negotiators were set to meet again next month, so the development Trump touted on Monday didn't itself amount to a breakthrough. But any sign the two sides are continuing to work toward a deal comes as a welcome development for other G7 leaders, who blame the protracted trade war for weighing down growth.

"We will see what happens but I think we will make a deal," Trump said during an earlier meeting with Egyptian leader Abdel Fattah el-Sisi.

Trump remains isolated

The note of optimism aside, there was little evidence Trump was preparing any actual acts of conciliation that might have helped the group of leaders put on a show of unity on their final day of talks. He did not say he was considering removing any existing tariffs or stalling the ones due to take effect this week.

Trump was absent from the start of a session devoted to climate change , his chair sitting empty while other leaders began the talks. Ahead of the G7, US officials said the President viewed sessions devoted to climate change and oceans a poor use of time, preferring instead to focus on the economy.

Asked whether he considers climate change a priority during his concluding press conference, Trump said the US has "tremendous" wealth that he does not want to lose on "dreams" or "windmills."

At the past two G7s, Trump has dashed his counterparts' attempts to put forward a show of unity on the issue.

Interactions throughout the summit, held amid throngs of French vacationers concluding their summer holidays on the picturesque Basque coast, have been tense, according to officials from multiple countries. Trump has harangued his counterparts on topics from Iran to trade to Russia, which he ardently argued during a Saturday evening dinner should be readmitted to the summit next year.

There have been plenty of friendly moments. Trump was thrilled to meet the new British prime minister Boris Johnson over scrambled eggs and veal sausage on Sunday, considering him a closer political ally than any of the other leaders. And Trump eagerly announced an "agreement in principle" on trade with Japanese Prime Minister Shinzo Abe, though final details were still being put down on paper.

But the strife between Trump and fellow leaders was still apparent. Even Johnson admitted Sunday he opposed Trump's trade war with China.

Trump's aides huffed ahead of time that the summit's agenda was an attempt to bolster Macron politically while isolating the United States.