WARSAW — President Trump said on Thursday that Western civilization was at risk of decline, bringing a message about “radical Islamic terrorism” and “the creep of government bureaucracy” to a European capital he views as hospitable to his nationalist message.

Mr. Trump, who broke with tradition by attacking American leaders and his country’s intelligence services while abroad, delivered his message in a speech to a friendly Polish crowd before a two-day summit meeting of Group of 20 leaders in Hamburg, Germany.

Hours later, he flew from Warsaw to Hamburg, where he held a low-key private meeting with the German chancellor, Angela Merkel. She perhaps best symbolizes the deep skepticism shared by Western leaders toward Mr. Trump’s persona and his policies, ranging from addressing climate change to confronting Russia.

In what may be a foretaste of the scene during the gathering, 12,000 protesters vowing to disrupt the G-20 summit meeting converged for a demonstration in Hamburg on Thursday night called “Welcome to Hell.” There were reports that dozens of police officers had sustained minor injuries as a small group of protesters attacked them with bottles, poles and iron bars in clashes that lasted until midnight. Up to 100,000 protesters were expected in the coming days.