PARIS — President Emmanuel Macron landed in China to a red-carpet reception and all the pomp of a state visit, a three-day tour little short of a love-fest that he clearly hoped would further his ambitions for France to sit at the table of the great powers in a world changed by Russia’s invasion of Ukraine and Beijing’s emergence as an arbiter of global conflict.

But Mr. Macron’s reception on returning to Europe has been chilly.

Already embattled at home, facing huge weekly protests in the streets, he now finds himself excoriated abroad for what has been criticized as his naïveté — first with President Vladimir V. Putin of Russia, whom he failed to dissuade from war after an intense courtship, and now with China’s president, Xi Jinping, who wants to drive a wedge between Europe and the United States and has warned of American “containment.”

The fallout from the China trip has left the French president more isolated than at any time in his six-year presidency, unpopular in France and mistrusted beyond it as he attempts to reshape not only his own country but also the foundations of whatever international order will emerge after the war in Ukraine.

In short order in China, Mr. Macron managed to alienate or worry allies from Warsaw to Washington, with his embrace of what a Sino-French declaration called a “global strategic partnership with China.” He adopted the Chinese lexicon of a “multipolar” world, freed of “blocs,” liberated from the “Cold War mentality,” and less reliant on the “extraterritoriality of the U.S. dollar.”

Most worrisome, particularly for the United States, he suggested in an interview with Politico and French journalists on the way home that the security of Taiwan is not the problem of a Europe that must resist becoming America’s “vassals.”

How Taiwanese democracy and freedom differ from Ukrainian democracy and freedom, and how the threat of Russian autocracy differs from the threat of a Chinese autocracy that backs Moscow, were two questions left unanswered by Mr. Macron.

Speaking of Taiwan, he said: “The worse thing would be to think that we Europeans must become followers on this topic and take our cue from the U.S. agenda and a Chinese overreaction.”

By Tuesday the Élysée Palace, home to the president, felt it necessary to clarify France’s allegiances, so muddied had the optics become. France, it said, “is not equidistant between the United States and China. The United States is our ally, with shared values.”

The fact that this clarification was necessary suggested how much Mr. Macron had unsettled his allies.

“The alliance with the United States is the absolute foundation of our security,” Mateusz Morawiecki, the prime minister of Poland, said on Tuesday in an evident riposte to Mr. Macron, noting that some Western leaders “dream of cooperation with everyone, with Russia and with some powers in the Far East.”

The comment underscored how Mr. Macron often speaks for Europe’s ambitions and dreams even as sharp divisions persist on the continent, particularly between frontline states bordering Russia that are fiercely attached to NATO, and Mr. Macron’s Gaullist vision of a France that is “allied but not aligned” with Washington.

Senator Marco Rubio of Florida, a Republican, recorded a two-minute video lambasting Mr. Macron in which he asked: “Does Macron speak for all of Europe? Is Macron now the head of Europe? Because if he is, there are some things we are going to have to change.”

One such change, he said, might be America telling Europe: “You guys handle Ukraine.”

This suggestion pointed to one of the issues with Mr. Macron’s remarks. Talk of building European “strategic autonomy” at a time when the United States is providing the vast bulk of the military support for Ukraine seemed provocative, especially with an American election year looming and restiveness growing in the Republican Party over massive spending on Ukraine.

Another was timing: Mr. Macron spoke hours before China began threatening military drills around Taiwan in response to a meeting days earlier of the Taiwanese president, Tsai Ing-wen, with the speaker of the United States House of Representatives, Kevin McCarthy, in California.

“It matters where and when you say things,” said Guntram Wolff, the director of the German Council on Foreign Relations. “When you leave Xi and immediately say Taiwan is none of our business it seems bizarre.”

He added: “If you think Europe should give up on Taiwan, you immediately are asked, who else do you give up on?”

The Biden administration refrained from criticizing its French ally, and the European Union played down any differences between Mr. Macron and Ursula von der Leyen, the European Commission president who accompanied him to China. She was far more forthright on Taiwan while there, saying, “Nobody should unilaterally change the status quo by force in this region.”

Ms. von der Leyen received none of the lavish attention showered on Mr. Macron. China prefers nation states to transnational entities, and had bristled at a speech she made this month in which she criticized China as “more repressive at home and more assertive abroad.”

On the face of it, Taiwan does matter to Europe for economic and political reasons. The world runs on Taiwanese chips. The island democracy produces over 60 percent of the world’s semiconductors and about 90 percent of the most elaborate ones.

After China’s crushing of democratic aspirations in Hong Kong, the implications of a Chinese invasion of Taiwan and the suppression there of liberal democracy would be devastating for the very causes Europe and Mr. Macron have committed to defend in Ukraine.

The French presidential statement said: “Our position on Taiwan is constant. We support the status quo and maintain our exchanges and cooperation with Taiwan, which is a recognized democratic system.”

Yet after his failed attempt to sway Mr. Putin last year with similar talk of a new “strategic architecture” for Europe, Mr. Macron has clearly decided to woo Mr. Xi. He hopes not only to reap economic and trade benefits but also to secure Chinese mediation in ending the war in Ukraine. There was no evidence of any such assistance from Mr. Xi during the visit.

Senator Lindsey Graham, Republican of South Carolina, was not impressed by Mr. Macron: “His latest visit to China only emboldens the Communists and President Xi, who seems to be hellbent on rewriting world order and taking Taiwan by force,” he commented on Twitter.

But of course it is precisely such Republican confrontational goading of China that Mr. Macron does not want to see Europe drawn into despite itself.

The immediate cost for Mr. Macron appears high.

“A debacle,” said Nicole Bacharan, a prominent French foreign policy analyst, of Mr. Macron’s interview in Politico, which also revealed that the Élysée had insisted on “proofreading” the story and had cut “some parts of the interview in which the president spoke even more frankly about Taiwan and Europe’s strategic autonomy.”

On Tuesday Mr. Macron made another state visit, traveling to the Netherlands. “Our Europe is made of dreams,” he said there, adding “I don’t want my dreams to be dreamed in other people’s language.”

It was unclear whether he was referring to American or Chinese.

On Thursday, another big demonstration against Mr. Macron’s pension reform is scheduled in France. Anger still runs high.

“He is looking for a new orientation,” said one government minister who was not authorized to speak and declined to be named. “But with no stable coalition in Parliament, it’s difficult.”

Matina Stevis-Gridneff and Steven Erlanger contributed reporting from Brussels, and Aurelien Breeden from Paris.