PARIS — With a warm clasping of hands, President Trump and President Emmanuel Macron of France cemented an unlikely but budding relationship Friday, capped by a Bastille Day military parade in Paris meant to emphasize the alliance between the United States and its oldest ally.
Despite some wariness in the initial contacts between Trump, 71, and Macron — who at 39 is the same age as Trump’s eldest son, Donald Trump Jr. — the American leader’s two-day visit to France ended on a high note.
Trump had publicly supported Macron’s far-right opponent, Marine Le Pen, in France’s presidential elections. Trump and Macron have sharply differing views on a range of issues, most notably the Paris accord, the climate change pact that Trump renounced six weeks ago.
But the two appeared to have moved beyond their tense introduction in May, when a tight handshake that Macron later said was meant to show he’s no pushover was widely interpreted as a sign of the fraught relations to come.
While Trump’s brand of ‘‘America First’’ politics has unsettled some European allies, Macron has positioned himself to be a mediator between Trump and other leaders of the continent.
In Paris this week, the two presidents seemed to focus on areas where they can work together, such as the crisis in Syria and Mideast security.
At a news conference, Trump declined to repeat his past criticism of Paris, saying instead that the city’s future is bright because France has a ‘‘great’’ and ‘‘tough’’ leader in Macron.
Macron and his wife, Brigitte, beguiled Trump and his wife, Melania, with red-carpet treatment and catered to Trump’s well-known penchant for military displays of power, which were woven into the Bastille Day parade they attended before flying home. It was Trump’s first visit to France as president.
The two presidential couples celebrated their new relationship over dinner at the Jules Verne restaurant in the Eiffel Tower on Thursday night.
On Friday morning, Trump and Macron arrived for the Bastille Day festivities in their motorcades. There were gasps from some attendees as Melania Trump emerged from the presidential limousine in a white dress with green floral print.
Tanks rolled down the Champs-Élysées, the Arc de Triomphe framed behind them, memorializing the storming of the Bastille that helped set off the French Revolution. The parade also celebrated the 100th anniversary of the United States’ entry into World War I.
Trump sat between his wife and Macron on the presidential viewing stand, an overhang shading them from the baking sun. Trump talked excitedly to Macron as a variety of World War I-era tanks rolled to a stop near the viewing stand.
The US president, who has a fascination with displays of military strength, had hoped to have tanks and jets at his own inaugural parade, but he was told he could not. So the Bastille Day parade seemed like a natural fit for Trump, who sometimes appears bored at public events but who seemed transfixed at the performance in Paris.
Trump’s joy appeared to crest when warplanes made their appearance. He could be seen gesticulating and whispering to Macron as an array of jets thundered past, including one leaving trails in the colors of the French and American flags.
Dozens of soldiers on horseback passed by the two presidents in formation.
The US Embassy said nearly 200 US service members took part in the celebration. They included Air Force Thunderbirds and soldiers dressed in World War I uniforms.
Security was tight, with the streets near the parade area sealed off for blocks in a city that has been hit by several terrorist attacks over the past two years.
After two hours, the parade ended with a musical interlude, including one honoring the victims of the terrorist attack in Nice a year ago.
In Nice later in the day, Macron vowed to ‘‘fight without mercy’’ inside and outside France to end extremist attacks like the one that killed 86 revelers there last year.