BIARRITZ, France — President Trump offered deeply contradictory signals about his trade war with China on Sunday, ending the day by escalating his threats of higher tariffs even as he remained isolated from fellow world leaders on a strategy that has rattled the global economy.
A day after defending his authority to order American companies out of China, Mr. Trump started Sunday by conceding that he was having “second thoughts” about a new round of levies on Chinese goods. Within hours, he abruptly reversed himself again, saying that he only regretted not raising tariffs even higher.
The president’s rhetorical whipsaw came against the backdrop of tense but cordial meetings in Biarritz, France. It injected fresh uncertainty into Mr. Trump’s efforts to try to change Chinese behavior by gambling on the fate of hundreds of billions of dollars in products that flow between the two countries.
“I think they respect the trade war,” Mr. Trump said of his allies assembled here for the Group of 7 annual gathering. Of China, he said: “What they’ve done is outrageous, that Presidents and administrations allowed them to get away with taking hundreds of billions of dollars out every year.”
Allies of the United States have long agreed that China’s policies are a threat, but there is little consensus behind Mr. Trump’s approach, and a deep nervousness that the president is going to tip the global economy into recession, hitting already trembling European economies particularly hard.
But far from using the gathering here to assemble a united front against Chinese trade policies, Mr. Trump set himself apart once again by making it clear he has no intention of backing down.
The heads of state from some of the world’s leading democracies treated Mr. Trump delicately at the summit in the beach resort in the South of France, hoping to avoid triggering an angry outburst. But several challenged Mr. Trump publicly on the issues of trade, North Korea and Russia.
Even Boris Johnson, Britain’s new prime minister who sees eye to eye with the American leader more than the other leaders, publicly chided Mr. Trump about the value of free trade and the dangers of an extended confrontation over trade.
“We’re in favor of trade peace on the whole,” Mr. Johnson told the president, in a mild-mannered rebuke of Mr. Trump’s embrace of tariffs as a bludgeon against allies and adversaries alike. “The U.K. has profited massively in the last 200 years from free trade and that’s what we want to see.”
Signs of a weakening global economy that has renewed fears of recession in the United States and Europe have underscored the dangers inherent in the president’s go-it-alone attempts to confront Chinese policies that even his critics concede are damaging to American interests.
Back home, Democrats have been critical of Mr. Trump’s approach, saying American leverage in the trade war is weakened by the president’s failure to work with allies in a concerted approach to change China’s course.
So far, China has evaded some of Mr. Trump’s tariffs by buying more from other countries, though the trade dispute has also impacted American allies like Germany, where the economy has slumped.
But Mr. Trump appeared to quickly shrug off any doubts he might have been harboring.
Days before arriving in Biarritz, Mr. Trump angrily tweeted that he was ratcheting up tariffs on Chinese goods in response to Chinese retaliation for earlier levies.
By Sunday morning, though, he was wavering about whether to impose the additional levies and retreated on his threat upon landing in France to declare an emergency so that he could order American companies out of China. After having declared Xi Jinping, the leader of China, an enemy, Mr. Trump said that “we’re getting along very well with China right now.”
“I have second thoughts about everything,” he said.
But the rare expression of doubt — from an American president who almost never admits to being wrong or even of changing his mind — lasted less than five hours.
After Mr. Trump was briefed by aides on the coverage of his statements, including headlines describing him as softening on China, the White House issued a blunt statement saying his answer about having “second thoughts” had been misinterpreted by reporters covering the summit.
“President Trump responded in the affirmative — because he regrets not raising the tariffs higher,” Stephanie Grisham, the White House press secretary, said in a statement. Hours later, Larry Kudlow, the president’s top economic adviser, and Treasury Secretary Steven Mnuchin insisted that there should be no doubt about Mr. Trump’s resolve.
“His only second thoughts, as I said, was maybe he should raise tariffs more,” Mr. Mnuchin told reporters. “The deficit is getting bigger and the president is determined that we have free and fair and reciprocal trade.”
Mr. Trump, whose efforts to win approval for a North American trade deal remain mired in congressional limbo, seized an opportunity to demonstrate some concrete progress on trade by announcing that the United States and Japan had “agreed in principle” on a deal to avoid a trade dispute.
The tentative agreement, announced by the country’s leaders at a meeting on the sidelines of the Group of 7 in France, would pry open Japan’s notoriously tight agricultural markets. It would allow American farmers and ranchers to compete on more equal footing with members of the Trans-Pacific Partnership, a multinational trade agreement concluded under the Obama administration but abandoned by Mr. Trump.
As part of the agreement, Japan has agreed to buy “hundreds of millions of dollars of corn” Mr. Trump told reporters, adding that Japanese prime minister Shinzo Abe had promised to buy up “excess” corn that had once gone to China.
But that deal is not yet finalized and Mr. Trump remains so at odds with many of his counterparts that the President Emmanuel Macron of France said it would be ‘‘pointless’’ for the gathering to try and issue its usual joint statement.
After signing on to a joint statement following the G7 in Canada last year, Mr. Trump angrily denounced the agreement and declared in a tweet that he would not sign it. He lashed out at Justin Trudeau, the prime minister of Canada, calling him “very dishonest and weak.”
This year, Mr. Trump took exception to the suggestion by “the Fake and Disgusting news” that his relations with his counterparts were once again strained, insisting that “we are having very good meetings, the Leaders are getting along very well.”
But there were clear points of contention, Russia among them.
Russia was suspended from the club’s meetings in 2014 after it seized Crimea from Ukraine and supported militias trying to break parts of eastern Ukraine away from the country. Mr. Trump said last week that he thought bringing Moscow back into the fold would be “appropriate,” drawing quick rebuffs from France, Germany and Britain.
Administration officials downplayed the issue, noting that Russia had not asked to rejoin the club. But on Sunday, Mr. Trump said the United States, as the host of next year’s meeting, might invite Russia to participate. He said the question of whether to invite Russian President Vladimir Putin to their meeting next year prompted a “lively” discussion behind closed doors.
Mr. Trump’s suggestion that North Korea’s recent firing of short-range missiles was not “in violation of an agreement” prompted a firm rejection from Shinzo Abe, the Japanese president. He said it “clearly violates the relevant U.N. Security Council Resolution.”
Even as Mr. Trump focused on economic issues, Mr. Macron, the host of the summit, tried to forge an unlikely consensus on Iran after many months of discord between Mr. Trump and European leaders over the future of the 2015 nuclear agreement.
While Mr. Macron told French television that the gathered leaders agreed to a joint message to Iran, Mr. Trump later said he had not discussed that but did not object to French efforts to reach out to Tehran.
In a dramatic surprise, Iran’s foreign minister, Mohammad Javad Zarif, showed up in Biarritz just a few hours later, flying in for meetings of his own. Iranian officials said he would not meet with any Americans. Mr. Mnuchin repeated Mr. Trump’s past assertion that he was open to negotiating and “he would not set preconditions to those negotiations.”
Mr. Macron, who says that economic inequality should be the Group of 7’s primary focus, invited the leaders of India, South Africa, Australia and Chile to take part in the group’s discussions along with the heads of member nations. On Sunday, Mr. Macron hosted a session focusing on Africa with the leaders of Burkina Faso, Egypt, Rwanda, Senegal and South Africa.
But Sunday’s gathering was overshadowed by the president’s back-and-forth comments about China and the efforts by his top economic aides to reinforce Mr. Trump’s refusal to back down from the trade war he started.
If Ms. Grisham’s statement had left any doubt about where the president stood, Mr. Kudlow and Mr. Mnuchin appeared on several television programs to declare that Mr. Trump had not had a change of heart.
“The president is bound and determined to defend the American economy against unfair trading practices that have damaged certain sectors of our economy,” Mr. Kudlow told reporters in an impromptu news conference with the Atlantic beaches as a backdrop. “So he’s gonna see it through. There’s no plans to change that.”
Stephen Miller, the president’s senior adviser, also made a rare appearance on Fox News to drive the point home.
“The only second thoughts the president is having,” Mr. Miller said, “is whether to be even tougher and even more aggressive.”