President Emmanuel Macron of France struck a chummy tone with President Trump even as he corrected him with a smile during joint appearances on Monday. That one-two punch of flattery and gentle resistance is an example of how some European leaders are trying to approach America at a fraught moment.

The question is whether it will work.

Mr. Macron called Mr. Trump “Dear Donald” four times during a joint news conference on Monday, while emphasizing the shared history between France and the United States — and underscoring that the two leaders had made progress in discussing a sustainable and strong peace agreement for Ukraine.

But even as he stuck to the script and emphasized shared goals and values, Mr. Macron showed himself willing to push back.

When Mr. Trump claimed in the Oval Office that Europe would “get their money back” because of the way they have funded support for Ukraine, Mr. Macron interjected, in a friendly tone, saying, “We provided real money.” And later, in an interview with Fox News before returning to France, Mr. Macron mildly criticized threats to slap tariffs on European consumer goods as counterproductive. “How do you want us to increase security and defense expenditures if we are in a trade war?” he asked.

Europe faces a towering challenge as the full-scale war in Ukraine enters its fourth year and American support for the conflict — and for the continent as a whole — wavers.

Mr. Macron’s trip was part of a flurry of European diplomacy this week in Washington, with Prime Minister Keir Starmer of Britain expected to meet Mr. Trump on Thursday, and the European Union’s top diplomat, Kaja Kallas, making the rounds with administration officials. European leaders will have a special March 6 summit on supporting Ukraine and strengthening Europe’s defense, and Mr. Macron is poised to debrief them on Wednesday on what he’s learned from Mr. Trump.

European officials are desperate to keep the United States engaged and active. American military capabilities and funding have been critical to supporting Ukraine’s resistance, and the United States is a key trading partner for the 27-member European Union. A deterioration in the trans-Atlantic relationship is in neither’s interest, E.U. leaders often emphasize.

America’s tone shift has been so sudden and stark that it has left Europe on the defensive. Mr. Trump has spent recent days and weeks sharply criticizing European allies while making increasingly friendly overtures toward Russia. Among his complaints, Mr. Trump has long insisted that European nations spend more on their own security — a message that Mr. Macron is particularly comfortable delivering.

The French president has for years called for Europe to have more “strategic autonomy” and less military dependence on the United States — often to skepticism from some of France’s neighbors. He underscored it again with Mr. Trump.

“Everyone in Europe is now clear that it is our duty as Europeans” to shoulder more of the continent’s security burden, Mr. Macron said in Washington. “Europeans are now ready to do a lot more.”

Mr. Macron said that Europeans could send troops as part of a future peace deal — not on the front lines of a conflict, but as a peacekeeping force — and that the United States would act in “solidarity” to support that approach.

There were few details about how the United States would do so. And if it became necessary, it would take lots of troops, money and time for Europe to develop the capabilities needed to support Ukraine and defend itself independently. That helps to explain why officials are softly urging the United States to remain engaged, and why they are reminding American officials that doing so is in Washington’s own interest.

“Autocrats around the world are watching very closely whether there is any impunity if you invade your neighbor and violate international borders,” Ursula von der Leyen, president of the European Commission, said in Kyiv, the Ukrainian capital, on Monday.

“This is not only paramount for Europe,” she added. “It is also important for Asia, for Africa, and both sides of the Atlantic.”

It is also not clear whether Mr. Macron and other European leaders can influence Mr. Trump on Ukraine as the American leader embraces President Vladimir V. Putin of Russia and redefines that relationship. The statements and actions emerging from Washington have left European officials concerned that Mr. Trump will negotiate a rapid peace agreement with Russia without including Ukrainian and other European leaders, laying the groundwork for a truce that leaves Kyiv vulnerable and emboldens Mr. Putin. That in turn, the Europeans fear, would leave other nations on the continent at risk of future invasion.

“We do share the objective of peace, but we are very aware of the necessity to have guarantees and solid peace in order to stabilize the situation,” Mr. Macron said in the Oval Office on Monday.

On the surface, Mr. Trump and Mr. Macron were all broad smiles and firm handshakes during the French president’s visit. They addressed each other as close friends, reminisced about past meetings — including a Bastille Day gathering in 2017 and Notre-Dame Cathedral’s reopening last year — and played up a centuries-old Franco-American alliance that stretches from Lafayette to World War II.

“The United States and France always stand on the same side, the right side, I would say, of history,” Mr. Macron said. “This is what is at stake today.”

He was also careful not to antagonize Mr. Trump directly and repeatedly put a positive spin on the American leader’s latest overtures to Russia.

Mr. Macron — criticized himself in the early stages of the war for outreach to Mr. Putin, before taking a harder line — called discussions with Russia “useful.” He even framed U.S.-Ukraine discussions over a mineral deal as a great sign, telling Fox News in an interview that it was “one of the best ways” to ensure the United States was committed to “Ukrainian sovereignty.”

Behind the united calls for peace, though, were starkly divergent views on how to obtain it. Mr. Trump suggested, “We could end it within weeks, if we’re smart.” Mr. Macron repeatedly hammered his own message: Don’t rush.

Peace cannot mean Ukraine’s “capitulation,” Mr. Macron said, adding that Ukraine should not be pushed into a lopsided cease-fire without security guarantees to deter future Russian aggression.

“We want peace, and I think the initiative of President Trump is a very positive one,” Mr. Macron told Fox News. “But my message was to say, ‘Be careful,’ because we need something substantial.”

As a cautionary tale, Mr. Macron repeatedly mentioned the 2014 and 2015 cease-fire agreements, known as the Minsk Accords, that were forged after Russian-backed separatists attacked and grabbed territory in eastern Ukraine. Those deals failed to prevent Russia’s 2022 invasion of Ukraine.

“It was violated every time by Russia, and we didn’t react, all of us,” Mr. Macron said.