President Trump delivered a stern rebuke to NATO and European leaders to their faces Thursday, saying the security alliance would be fighting terrorism better if members were paying their fair share for the common defense.

“NATO would be even stronger than it is today, especially from the threat of terrorism,” Mr. Trump said at the unveiling of a 9/11 memorial at NATO headquarters in Brussels.

The president even mocked NATO for the roughly $1 billion cost of its gleaming new glass-and-steel headquarters where the ceremony took place.

SEE ALSO: See how much each NATO country spends on defense

“I never asked once what the new NATO headquarters cost. I refuse to do that,” Mr. Trump said. “But it is beautiful.”

Liberals back home recoiled at Mr. Trump’s blunt confrontation of U.S. allies. House Minority Whip Steny H. Hoyer, Maryland Democrat, said the president’s remarks “were an embarrassment for our country.”

“I was appalled by his condescending remarks to NATO leaders today,” Mr. Hoyer said.

VOTE NOW:

Other U.S. presidents, including Barack Obama, have urged NATO members to boost their defense spending, but Mr. Trump’s appeal was “the most forthright declaration” of all, said Nile Gardiner, director of the Margaret Thatcher Center for Freedom at The Heritage Foundation.

“He made the right points,” Mr. Gardiner said. “He really laid down the gauntlet to NATO.”

The White House said later that NATO members expressed unanimous support at a dinner meeting for a resolution that will commit each nation to at least 2 percent of its gross domestic product to defense and to share the burden of combating terrorism.

“It was a very positive reaction and affirmation of the president’s priorities,” said White House press secretary Sean Spicer.

A critic of the alliance during his election campaign, Mr. Trump said Thursday that NATO would have had $119 billion more to spend in the past year alone against terrorism threats and the challenges of lax immigration standards if more of its members paid the required 2 percent.

“Twenty-three of the 28 member nations are still not paying what they should be paying,” Mr. Trump said, with NATO Secretary General Jens Stoltenberg and a host of European heads of state standing by his side. “This is not fair to the people and taxpayers of the United States.”

The five NATO members that paid at least 2 percent last year were the U.S., 3.61 percent; Greece, 2.38 percent; Britain, 2.21 percent; Estonia, 2.16 percent; and Poland, 2 percent.

The president also suggested that NATO members that have shirked their requested payments are in arrears.

“Many of these nations owe massive amounts of money for past years and not paying in those past years,” Mr. Trump said. “Over the last eight years, the United States spent more on defense than all other NATO countries combined. We should recognize that with these chronic underpayments and growing threats, even 2 percent of GDP is insufficient in modernizing readiness and the size of forces. We have to make up for the many years lost.”

Mr. Trump began his remarks by asking for a moment of silence for the victims of Monday’s terrorist attack in Manchester, England.

“The recent attack on Manchester and the United Kingdom demonstrates the depths of the evil we face with terrorism,” Mr. Trump said. “Terrorism must be stopped in its tracks, or the horror you saw in Manchester and so many other places will continue forever. We must be tough, we must be strong and we must be vigilant.”

He blasted European leaders for their lax immigration standards. German Chancellor Angela Merkel especially has been criticized at home for allowing too many Middle Eastern refugees into Germany.

“You have thousands and thousands of people pouring into our various countries and spreading throughout, and in many cases we have no idea who they are,” Mr. Trump said, with Ms. Merkel standing nearby. “The NATO of the future must include a great focus on terrorism and immigration, as well as threats from Russia on our NATO’s eastern and southern borders.”

Mr. Hoyer said the president “should not be lecturing our closest and most steadfast allies but reaffirming our common defense and our commitment to stand with them.”

“President Trump’s call for NATO members to pay for common defense as though the NATO alliance were a transactional relationship, along with his repeated insistence on banning immigration, risk undermining the alliance and the principles for which it stands,” Mr. Hoyer said.

“Instead of lecturing our allies about payments, President Trump ought to express America’s gratitude for the leadership and sacrifices we have seen from nations like Germany, which has absorbed hundreds of thousands of Syrian refugees; Denmark, which has sent troops to Afghanistan and maintains peacekeeping forces in Kosovo; and Canada, whose air force jointly patrols the skies over North America to protect our hemisphere.”

Mr. Trump said the grave security concerns he outlined “are the same reason that I have been very, very direct with Secretary Stoltenberg and members of the alliance in saying that NATO members must finally contribute their fair share and meet their financial obligations.”

Mr. Stoltenberg introduced Mr. Trump by reminding him that NATO invoked Article 5, the clause that requires the alliance to respond to an attack against any member, for the first time in 2001 after the 9/11 attacks. The NATO memorial includes a section of twisted steel from the World Trade Center, as well as a portion of the Berlin Wall.

“It is our solidarity that keeps our nations safe,” Mr. Stoltenberg said. “When our open and free societies come under attack, we stand up for our values and our way of life. That is why a strong NATO is good for Europe and good for North America.”

Mr. Trump, who questioned the U.S. commitment to Article 5 during his campaign, mentioned the clause Thursday only in the context of 9/11. But his remarks left little doubt that he intends to honor the long-standing commitment.

“We will never forsake the friends who stood by our side, and we will never waver in our determination to defeat terrorism and to achieve lasting security, prosperity and peace,” Mr. Trump said.

Nicholas Burns, former U.S. ambassador to NATO, said Mr. Trump made a “major miscalculation” by not directly affirming his support of Article 5 for his European audience.

“They need to know that we’re going to be with them to support them in time of need by invoking Article 5, and they did not hear that from President Trump,” Mr. Burns said on MSNBC. “He’s really got to step up to be leader of the West because he’s not showing it right now.”

White House advisers rejected the criticism, saying Mr. Trump’s presence at a ceremony dedicated to Article 5 demonstrated clear support for the principle.

“We’re not playing cutesie with this. He’s fully committed,” Mr. Spicer said. “Having to reaffirm something by the very nature of being here and speaking at a ceremony about it is almost laughable.”