President Trump and French President Emmanuel Macron worked Saturday to ease tensions after a dustup over their comments about European security that threatened to divert attention away from a weekend celebration marking 100 years since the end of World War I.

The American and French leaders, who have had somewhat of an up-and-down relationship, worked to project unity on whether Europe should create an army as they addressed reporters before they retreated behind closed doors at the Elysee Palace.

Mr. Trump's visit to France opened on a testy note after he unleashed an angry Twitter jab at his host as he arrived for the celebration. Just as Air Force One touched down in Paris Friday night, Mr. Trump tweeted that Macron "has just suggested that Europe build its own military in order to protect itself from the U.S., China and Russia. Very insulting, but perhaps Europe should first pay its fair share of NATO, which the U.S. subsidizes greatly!"

Get Breaking News Delivered to Your Inbox

Macron's office said Mr. Trump misunderstood Macron's comments about sharing the defense burden and the two men struck a more friendly tone as they opened their meeting at the grand presidential residence.

"We want to help Europe but it has to be fair. Right now, the burden-sharing has been largely on the United States," Mr. Trump said, adding that Macron "understands that and he understands the United States can only do so much, in fairness to the United States."

Mr. Trump added that the U.S. wants to "absolutely be there" to help defend Europe but that "different countries have to also help."

Macron defended his viewpoint, saying "I do share President Trump's views that we need a much better burden sharing with NATO and that's why I do believe that my proposal for a European defense" is "utterly consistent with that."

Macron said it's "unfair to have the European security today being assured just by the United States."

President Donald Trump meets with French President Emmanuel Macron inside the Elysee Palace in Paris Saturday Nov. 10, 2018. Jacquelyn Martin/AP

An official in Macron's office said Mr. Trump lumped together two different comments by the French president, and that the leaders would discuss the comments. By custom, the official was not authorized to be publicly named.

Macron said in an interview earlier this week that Europe needs to protect itself against "China, Russia and even the United States" in terms of cyberspace. Later, Macron reiterated that Europe needs to build up its own military because it can no longer depend on the U.S. for defense.

Mr. Trump has made similar arguments, particularly in urging NATO members to increase their defense spending.

It was the latest instance of Mr. Trump introducing tension before meeting with a world leader, then playing nice when they were face to face. Earlier this year, Mr. Trump insulted British Prime Minister Theresa May at an especially vulnerable time for her government in an interview with a British tabloid. He also threatened not to work toward a trade deal with Britain and said May's political nemesis would make a great prime minister. The interview was published as Mr. Trump attended a grand welcome dinner hosted by May hours after he arrived in London.

But Mr. Trump was far more cordial to May's face. He complimented her leadership and expressed his great respect for her.

Mr. Trump's comments aside, Macron welcomed Mr. Trump in the courtyard of the Elysee Palace with a handshake and pats on the arm. Inside a gilded meeting room, Macron referred to Mr. Trump as "my good friend" and tapped him on the thigh. Mr. Trump said they had become "very good friends over the last couple of years" and were "similar in our views" on many issues.

The tweet by Mr. Trump marked a fresh sign that the "America first" president was ready to go his own way yet again as world leaders gather to remember the coalition that brought an end to the first global war in which millions were killed.

Mr. Trump was joining scores of other world leaders for a Sunday ceremony in the shadow of the Arc de Triomphe to mark the WWI centennial. On Saturday afternoon, Macron will meet German Chancellor Angela Merkel in the town of Compiegne in northern France, BBC News reports.

On Saturday, the White House called off Mr. Trump's scheduled visit to a World War I cemetery due to poor weather. The Aisne-Marne American Cemetery is the site of a 1918 battle in which the American and French repelled German forces. More than 1,800 Americans died there.

White House chief of staff John Kelly, a retired Marine Corps general, his wife and Secretary of State Mike Pompeo will visit instead.