WARSAW (Reuters) - President Donald Trump affirmed the U.S. commitment to the defense of NATO allies on Thursday in a Warsaw speech that gently criticized Russia, and he said Western civilization must stand up to “those who would subvert and destroy it”.

In his second trip to Europe as president and shortly before leaving for a potentially fractious G20 meeting in Germany, Trump sought to ease the nerves of U.S. allies after failing in May to endorse the principle of collective defense enshrined in Article Five of the NATO treaty.

As a presidential candidate Trump called NATO obsolete, but he has since changed his position on the alliance’s relevance.

The president also had tough words for Russia on Thursday, though he did not fully endorse allegations, backed by U.S. intelligence agencies, that Moscow interfered in the 2016 presidential election that he won.

Trump meets President Vladimir Putin for the first time face-to-face on Friday in Hamburg, the site of the G20 summit.

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

The Kremlin said Russia was not guilty of any destabilizing activity.

The brief visit to Warsaw, which included a meeting with regional heads of state, was billed by the White House as an effort to patch up relations with European allies after a tense NATO summit in May.

Trump was received by enthusiastic crowds on a central Warsaw square - some 15,000 people according to police estimates - many arriving on busses arranged by parliamentary deputies of the ruling conservative Law and Justice (PiS) party.

People carried U.S. flags or placards with photographs of Polish President Andrzej Duda and Trump. Some wore t-shirts with American flag colors and many chanted the president’s name.

Trump reiterated his criticism of low defense spending levels by many European nations and praised Poland for meeting the alliance’s target of spending 2 percent of economic output on defense.

“To those who would criticize our tough stance, I would point out that the United States has demonstrated not merely with words but with its actions that we stand firmly behind Article 5, the mutual defense commitment,” he said to applause.

Article Five of NATO’s 1949 founding charter states that an attack on any member is an attack on all, and allies must render assistance, military if need be.

The stopover was a major diplomatic coup for Poland’s conservative government, which has faced mounting criticism from Brussels over its democratic record and a refusal to accept migrants fleeing war in the Middle East.

The euroskeptic administration agrees with Trump on issues such as migration, climate change, coal mining and abortion, and it wants EU institutions to give back some of their powers to national governments.

“We are against abortion, we promote life. These values are shared by President Trump. There is no other leader who would evoke God in his speeches so frequently,” said Lukasz, a 30-year-old teacher from the seaside city of Szczecin, who traveled to Warsaw with 40 others.

Slideshow ( 19 images )

QUESTION OF SURVIVAL

“We’ve discussed our mutual commitment to safeguarding the values at the heart of our alliance: freedom, sovereignty and the rule of law,” Trump said in a joint press conference after meeting Duda.

In what seemed like veiled criticism of the European Union, Trump condemned “the steady creep of government bureaucracy” and cited the importance of national sovereignty.

In his speech, near a monument that commemorates the 1944 Warsaw Uprising against Nazi Germany, the president painted the fight against terrorism, illegal immigration and excessive government powers as an existential one.

“The fundamental question of our time is whether the West has the will to survive... 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?” he asked.

Slideshow ( 19 images )

“We can have the largest economies and the most lethal weapons anywhere on earth, but if we do not have strong families and strong values, then we will be weak and we will not survive.”

European and other G20 partners have a view of Western values that does not align with Trump’s. German Chancellor Angela Merkel has allowed hundreds of thousands of Syrian refugees into her country, drawing both criticism and praise, and has made fighting global warming a top priority at the summit.

Trump has decided to pull the United States out of the Paris accord on climate change.

Trump’s repeated mention in his speech of the Warsaw Uprising against Nazi occupiers resonated strongly with supporters of the Law and Justice party.

Many conservative Poles see that fighting, in which thousands died and Warsaw was razed to the ground, as a defining moment in Polish history, symbolizing the country’s struggle against its powerful neighbor to the west, Germany.

“Honour to the heroes!,” they chanted when Trump mentioned the uprising.

But Trump’s welcome of Lech Walesa, the legendary hero of the Solidarity movement that shook communist rule in the 1980s, drew boos from the crowd, underlining deep divisions in Polish society over the country’s recent history and values.

The PiS believes Walesa, who won a Nobel Peace Prize, was a communist-era collaborator and see his term as president between 1990 and 1995 as a time when Poland lost sight of its Catholic identity.