HAMBURG — President Trump brought a starkly populist and nationalistic message to Europe on Thursday, characterizing Western civilization as under siege and putting the United States on a potential collision course with European and Asian powers that embrace a more cooperative approach to the world.

Speaking in Warsaw ahead of his arrival here in Germany for a contentious Group of 20 summit, Trump delivered an address that was both provocative and short on specifics — arguing that Western values are increasingly imperiled by “radical Islamic terrorism” and extremism and casting himself as a champion in a vaguely defined clash of cultures.

“The fundamental question of our time is whether the West has the will to survive. Do we have the confidence in our values to defend them at any cost?” Trump said, speaking at a monument to a past struggle, the 1944 Polish resistance to Nazi occupation in World War II. “Do we have enough respect for our citizens to protect our borders? Do we have the desire and the courage to preserve our civilization in the face of those who would subvert and destroy it?”

Later in the day, Trump took to Twitter to proclaim that “THE WEST WILL NEVER BE BROKEN. Our values will PREVAIL.”

The fiery address to a friendly crowd stacked with supporters of Poland’s populist ruling party did not define those Western values in any detail, however, and was devoid of the kind of explicit endorsement of democratic ideals common among past U.S. presidents. Unlike President Barack Obama last year, for example, Trump did not direct any criticism at his host, Polish President Andrzej Duda, for a crackdown on press freedoms and for other restrictive policies.

And on the eve of a planned 30-minute meeting with Russian President Vladi­mir Putin, Trump again refused to say definitively whether Russia had interfered in the U.S. elections, as U.S. intelligence agencies strongly assert, though he did rebuke Moscow for its “destabilizing activities” in Ukraine and elsewhere.

Trump’s foreboding message in Warsaw stood in stark contrast to the more optimistic notes struck by Germany’s Angela Merkel and other European leaders at the start of the G-20 summit here in Hamburg. The day’s events included the formal announcement of a trade agreement between the European Union and Japan, a deal akin in size to the North American Free Trade Agreement and other multilateral pacts that Trump has vilified and sought to scrap or alter.

Besides trade, the two-day G-20 meeting highlights several other fissures between Trump and European leaders, including on climate change and immigration.

As protesters clashed with police armed with pepper stray and water cannons outside the summit Thursday, Trump and Merkel met directly for about an hour, according to German officials, who characterized the meeting as friendly but contentious, particularly on trade.

“The question is whether the Americans are still convinced that world trade always needs to be assessed according to one question, namely whether the U.S. is the winner, or whether we’ll manage to convince the Americans that when everyone plays by the same fair rules, everyone will be better off,” German Foreign Minister Sigmar Gabriel told German broadcaster ARD afterward.

A U.S. account of the meeting made no mention of the tensions.

The stop in Poland — which Trump called “the geographic heart of Europe” — was both a symbolic and strategic choice for the new American president. The Eastern European nation is a critical U.S. ally and perhaps the European capital most welcoming to Trump’s nationalist message.

Leaving little to chance at a tightly choreographed speech, Polish government officials arranged for buses to bring supporters into the city from the rural parts of the country, where the ruling party’s support is strongest.

Poland is one of the few NATO countries that has met an agreement to contribute at least 2 percent of its gross domestic product to defense spending, an issue that Trump has repeatedly raised since the campaign. It was one of many things Trump praised Poland for on Thursday.

But Trump also said military spending alone is not enough to preserve Western civilization.

“Our own fight for the West does not begin on the battlefield,” he said. “It begins with our minds, our wills and our souls. Today, the ties that unite our civilization are no less vital and demand no less defense than that bare shred of land on which the hope of Poland once totally rested.”

Speaking with nationalist overtones, Trump praised Poland as an example of a nation that had persevered despite grave challenges, saying it offered “the story of a people who have never lost hope, who have never been broken, and who have never forgotten who they are.”

Poland’s current right-leaning, populist government has proven a natural ally for Trump. The country’s Law and Justice Party has embraced some of the main pillars of Trump’s candidacy, including a similar resistance to accepting Muslim refugees.

“While we will always welcome new citizens who share our values and love our people, our borders will always be closed to terrorism and extremism,” Trump said Thursday. He also decried “the steady creep of government bureaucracy that drains the vitality and wealth of the people.”

Trump’s speech was also notable for its explicit commitment to Article 5, the collective security provision of the NATO treaty. “The United States has demonstrated not merely with words, but with its actions, that we stand firmly behind Article 5, the mutual defense commitment,” Trump said.

Trump had notably left out a mention of Article 5 during a speech in late May at NATO’s new headquarters in Brussels. Every U.S. president since Harry Truman in 1949 has pledged to honor the policy that an attack on an alliance nation is an attack on all of them.

In a day of mixed messages toward Russia, Trump used his Warsaw speech to offer his firmest rebuke of Moscow.

“We urge Russia to cease its destabilizing activities in the Ukraine and elsewhere and its support for hostile regimes, including Syria and Iran, and instead join the community of responsible nations in our fight against common enemies and defense of civilization itself,” Trump said.

Earlier in the day, Trump struck a different tone. When asked during a joint news conference with Duda about Russian meddling in last year’s U.S. election, Trump refused to say definitively that he believes Russia was responsible.

“I think it could very well have been Russia, but I think it could well have been other countries” Trump said. “Nobody really knows. Nobody really knows for sure.”

Trump also used the appearance to continue his feud with CNN, saying the network has “been fake news for a long time.” He called NBC “equally as bad, despite the fact that I made them a fortune with ‘The Apprentice,’ ” a reference to the long-running reality show that starred Trump.

Shortly after arriving in Germany, Trump met with Merkel, with whom Trump has had a chilly relationship during his first months in office. Appearing briefly before the media, the pair appeared casual with each other and chatted freely. They shook hands while looking directly at each other — in contrast to their first meeting in Washington, when Trump declined a handshake in front of news cameras.

In a statement afterward, the White House said Trump and Merkel discussed a number of foreign policy and national security priorities, including the ongoing conflict between Qatar and Persian Gulf and Arab states, the North Korean crisis and the conflict in Ukraine.

Gabriel, the German foreign minister, said discussion of climate and trade issues “are still clearly contentious.” He and U.S. Secretary of State Rex Tillerson were among those who attended the meeting.

Gabriel has often advocated for better relations between the West and Russia, and he said Germany was “very happy” about the Friday meeting scheduled between Trump and Putin.

“If relations between the United States and Russia continue to be as bad as they are now, this is bad for the whole world,” he said.

Trump is also scheduled to meet Friday with Mexican President Enrique Peña Nieto. An earlier meeting between the two was canceled over Trump’s insistence that Mexico pay for a vast new wall along the border between the two countries.

On trade, Trump is attempting to leverage the United States’ economic power to negotiate deals in the country’s favor, but foreign leaders appear increasingly ready to bypass the U.S. president.

On the eve of the G-20 summit, leaders from Japan and the E.U. announced their agreement on the broad strokes of a trade deal that will cover nearly 30 percent of the global economy, 10 percent of the world’s population and 40 percent of global trade.

The announcement appeared to be a calculated rebuke of both the United States and Britain, which voted to leave the E.U. last year.

For Trump, another priority is shoring up support for his effort to contain North Korea after its defiant test of an intercontinental ballistic missile. Trump warned Thursday that North Korea could face “some pretty severe” consequences, but Washington also confronted firm opposition from Russia and China over any possible response.

Appearing briefly before the press before a dinner Thursday, Trump was asked by a reporter whether he had given up on Chinese President Xi Jinping to lean on North Korea to cease its activities.

“Never give up,” Trump said.

“Are you disappointed?” the reporter persisted, referring to Trump’s complaints in recent days that trade between China and North Korea has increased.

Trump didn’t answer.

Wagner reported from Washington. Ana Swanson in Washington and Stephanie Kirchner in Berlin contributed to this report.