But the French president’s comments showed that the pair do not agree on all subjects.

Mr Macron said isolationism, withdrawal and nationalism “can be tempting to us as a temporary remedy to our fears. But closing the door to the world will not stop the evolution of the world. It will not douse but inflame the fears of our citizens”

He added: “We will not let the rampaging work of extreme nationalism shake a world full of hopes for greater prosperity.”

Mr Macron said that the US had invented multilateralism and now needed to reinvent it to create a new 21st Century world order.

He said the UN and the Nato military alliance might not be able to fulfil their mandates and assure stability if the West ignored the new dangers arising in the world.

Bonhomie and blows

Analysis by BBC North America editor Jon Sopel

Macron has provided a masterclass to other world leaders on how to handle Donald Trump – you cuddle up close, you flatter where necessary – but you use that to allow you to pack a big punch.

He also spoke about the very special relationship between France and the US, a move that might have had some in Downing Street choking on their tea.

In a cleverly crafted speech, he started with the entente between himself and the US president that some said was just too cordial. But then came the punches – and they were hard-hitting jabs, taking direct aim at Donald Trump’s policy agenda. On free trade, on the importance of science, on inequality – and Mr Trump’s America First policies.

Then he audaciously borrowed Donald Trump’s Make America Great Again slogan to talk about the environment, and the importance of the climate change agreement the US has pulled out of. He said it was time to make the Earth great again.

The speech was punctuated by applause and cheering. This was an important moment in the US Congress. Emmanuel Macron has emerged as a world leader who offers a competing and sharply different world vision to the US president – while all the time maintaining a bonhomie with him. That’s quite a political feat.

On trade, Mr Macron said that “commercial war is not the proper answer”, as it would “destroy jobs and increase prices”, adding: “We should negotiate through the World Trade Organization. We wrote these rules, we should follow them.”

Mr Trump has in the past said that trade wars are good and easily won. He has taken on Europe and China with new tariffs, saying the US has suffered from unfair trade practices.

On another issue of difference, Iran, Mr Macron said his country would not abandon a nuclear deal with Tehran that was agreed by world powers when President Barack Obama was in office but which Mr Trump has branded “terrible”.

Mr Macron said: “This agreement may not address all concerns, and very important concerns. This is true. But we should not abandon it without having something more substantial instead.”

Mr Macron’s wide-ranging address highlighted numerous political and cultural links, citing American Revolutionary War officer Marquis de Lafayette, writer and feminist Simone de Beauvoir, Abraham Lincoln, author Ernest Hemingway, the founder of French romanticism François-René Chateaubriand and both Presidents Roosevelt.

His quoting of Franklin D’s “the only thing we have to fear is fear itself” drew one of his biggest applauses.

How did the speech go down?

Senior House Democrat Adam Schiff said Mr Macron had offered “more of a direct contradiction of the president than I was expecting”, telling AFP: “There were more than a few uncomfortable moments on the [Republican] side of the aisle.”

Republican Senator Jeff Flake said the speech was “very contrary to Trumpism, very much contrary to an America First agenda”.

But Republican House Majority Leader Kevin McCarthy denied there was any rebuke.

“He said in there that he believes in free and fair trade. That’s exactly what the president asked for,” he said.