WASHINGTON — President Trump welcomed Poland’s nationalist president to the White House on Wednesday with an elaborate show of support, promising more American troops, defending Warsaw’s record on democracy and staging a rare and showy F-35 jet flyover to mark their friendship.

In his latest embrace of Europe’s nationalist surge, Mr. Trump stood side by side with President Andrzej Duda and their wives on the South Lawn of the White House staring into the sky and waving as the Marine warplane roared overhead, buzzed around the Washington Monument and then headed back for a second pass.

A jet flyover above the White House is highly unusual, but Mr. Trump has agitated without success to hold a military parade down Pennsylvania Avenue and clearly relished showing off the state-of-the-art aircraft that Poland has agreed to buy. The flyover, however, startled many in the streets of Washington who did not know it was coming and, in some cases, pointed to the sky with worried looks or even started running.

“Moments ago we witnessed that impressive flyover of this cutting-edge F-35 as it flew over the White House and actually came to a — pretty close to a halt over the White House,” the president gushed afterward in the Rose Garden. “I would say: ‘What’s wrong with that plane? It’s not going very fast.’ But it is an incredible thing when you can do that. That plane can land dead straight and it is one of the few in the world that can do that.”