BERLIN — The new French president and the veteran German chancellor used their first engagement on Monday to declare their determination to salvage European unity now that France has beaten back the immediate risk from radical populism, which threatened to undo the European Union itself.

As has become tradition for a new leader in either France or Germany, the first trip abroad is to the other’s country, and Chancellor Angela Merkel continued in the regal spirit of Emmanuel Macron’s inauguration as French president on Sunday, greeting her visitor with full military honors.

Hundreds of onlookers, some waving European flags, cheered at the brief ceremony.

The pomp reflected a rare moment of hope for a European Union that has in recent years faced a relentless succession of troubles — the euro and debt crisis, a migration and border crisis, terrorist attacks, the British vote to bail on the bloc — that has left it staring at the prospect of disintegration.

The election of Mr. Macron now offers the bloc, but Ms. Merkel in particular, a chance to hit reset and for its core partners to press ahead with overhauls to save the decades-old project of economic and political comity that has preserved peace and prosperity on the Continent.