He came, he saw, he harangued.

U.S. President Donald Trump capped his first official visit to Brussels with a commanding — and meandering — speech at NATO's new headquarters, in which he berated allies for not spending enough on defense, insisted that even NATO's goal of increasing annual military expenditures to 2 percent of GDP was insufficient and provocatively declared that some allies "owed" arrears for years of lagging contributions.

Trump's remarks were also notable for what he did not say: to the consternation of some allies, Trump once again did not explicitly endorse NATO's common defense principle — that an attack on one is an attack on all.

"NATO members must finally contribute their fair share and meet their financial obligations, for 23 of the 28 member nations are still not paying what they should be paying and what they’re supposed to be paying for their defense," Trump said, standing outside NATO's gleaming new headquarters with fellow leaders of the alliance watching on uncomfortably.

"This is not fair to the people and taxpayers of the United States. And many of these nations owe massive amounts of money from past years and not paying in those past years," said Trump, who also appeared to push his way to the front of the leaders' group as the opening ceremony for the new building began.

"Two percent is the bare minimum for confronting today’s very real and very vicious threats" — U.S. President Donald Trump

"We should recognize that with these chronic underpayments and growing threats, even 2 percent of GDP is insufficient to close the gaps in modernizing, readiness, and the size of forces," Trump said. "We have to make up for the many years lost. Two percent is the bare minimum for confronting today’s very real and very vicious threats."

Trump's insistence that certain allies "owe" has already chafed at some leaders, particularly German Chancellor Angela Merkel, who visited Washington and was told by Trump that her country owes "vast sums."

Germany is the wealthiest country not currently meeting the NATO spending goal, but officials in Berlin have reacted angrily to Trump's tone and his strict cash basis approach to measuring contributions to the alliance. German officials have noted with some annoyance that Trump seems not to grasp how NATO financing works, particularly that each nation is judged on the money it spends on its own military and that a 2014 pledge to move toward 2 percent of GDP in annual military spending was voluntary.

German officials have also noted that it is impossible to quantify the value to the United States or NATO of having American forces, weapons and equipment stationed on German soil as they have been for decades or the value of lives lost in NATO military operations such as the war in Afghanistan.

Dedication ceremony

Trump's speech, which he began by decrying the recent terror attack in Manchester and leading NATO leaders in a moment of silence for the victims, was unexpectedly long. It was part of a dedication ceremony for a memorial to the 9/11 terrorist attacks, a twisted steel beam from the fallen World Trade Center site, which is intended as a reminder that the only time NATO invoked its collective defense clause was after that attack in the United States in September 2001.

And Trump began the ceremony to officially open the new NATO headquarters with an even more aggressive and unexpected move, appearing to physically shove Montenegro's Prime Minister Duško Marković out of the way to get to the front of the group and stand next to Secretary-General Jens Stoltenberg.

Hungarian Prime Minister Viktor Orbán, often known as the tough man of Europe, seemed to react with a surprised smirk as Trump clapped Marković on the shoulder and muscled his way to the front of the group. The president then demonstratively squared his shoulders, puffed his chest and straightened his suit jacket.

Trump's tough remarks on military spending were widely expected, but there was an open question about the tone he would use, and whether he would couple his criticism with a strong endorsement of NATO's collective defense clause. His comments on spending were also expected to come at a closed-door leaders' dinner, rather than in a public speech during the memorial dedication ceremony.

Some of the leaders clearly seemed taken aback, and several smiled nervously when Trump punctuated his lecture on spending by declaring: "And I never asked once what the new NATO headquarters cost. I refuse to do that. But it is beautiful."

If that was intended as a joke, it landed awkwardly. If not, it was a bizarre and striking display of an American president claiming magnanimity on the world stage. NATO's existing headquarters has lasted long past its intended use, with nearly 20 percent of the campus made up of portable structures. (Officials also insist that the new headquarters, with a final pricetag of €1.1 billion, cost slightly less than originally projected.)

While campaigning for office, Trump had raised doubts about his willingness as president to come to the aid of an ally under attack — unless allies made good on their financial commitments to NATO. Pressed on Trump's seeming unwillingness to commit to Article 5, the White House press secretary, Sean Spicer, pushed back, telling reporters that doubts of Trump’s commitment were “almost laughable” and that his visit was evidence of his support for NATO’s core tenets.

Spicer also described the overall NATO meeting as a victory for Trump "It was a very positive reaction and affirmation of the president's priorities today," he told reporters traveling with the president.

But Trump’s tirade about allies who “owe” debts left Stoltenberg in an uncomfortable and defensive position. At a news conference following the dinner, Stoltenberg insisted, under persistent questioning, that Trump’s “blunt” message on spending was well-received by other leaders and that the focus of discussions was the 2014 pledge.

Stoltenberg did, however, suggest there was at least some dispute with Trump’s framing of the spending question. The secretary-general said the alliance would not just measure a country’s commitment in cash. “The national plans will cover three major areas: cash, capabilities, and contributions,” he said.

Manchester attack

While Trump's remarks at the public portion of the event went on longer than expected, his main themes — defense spending and terrorism — had been expected by everyone. What could not have been predicted was the attack in Manchester that killed 22 and injured dozens more, providing a grim backdrop for the president's push for NATO to take on more responsibility in fighting terror threats.

He initially directed his remarks at U.K. Prime Minister Theresa May, telling her "All of the nations here today grieve with you and stand with you." And he called for a moment of silence.

Then he began a tirade against terrorists, saying, "All people who cherish life must unite in finding, exposing, and removing these killers and extremists — and, yes, losers. They are losers. Wherever they exist in our societies, we must drive them out and never, ever let them back in."

He also claimed to have received a commitment from Middle Eastern leaders that they would fight radical ideologies.

The 2 percent goal is more complicated than Trump's remarks indicated.

"This call for driving out terrorism is a message I took to a historic gathering of Arab and Muslim leaders across the region, hosted by Saudi Arabia," he said, adding: "The leaders of the Middle East have agreed at this unprecedented meeting to stop funding the radical ideology that leads to this horrible terrorism all over the globe."

The Manchester attack also created another unexpected and, for Trump, deeply uncomfortable, sub-plot to the ceremony at NATO, with May expressing anger and dismay over leaks, apparently by U.S. officials of details about the attacker.

A senior U.K. government official said: “The prime minister raised the issue of the intelligence leaks with the president while they were waiting for the family photo to be taken. The prime minister expressed her view that the intelligence-sharing relationship with the U.S. is hugely important and valuable but obviously the intelligence needs to be kept secure.”

The official would not characterize Trump's reaction, but there was no mistaking the weight of the apparent breach coming on the heels of Trump's own divulging of secret intelligence to senior Russian officials, in an apparent break with protocol and etiquette.

From his comments on Manchester, Trump moved on to his harangue on spending, which was forceful and unforgiving. "Over the last eight years, the United States spent more on defense than all other NATO countries combined," he said.

And, in a stinging rebuke to Stoltenberg who has worked hard to convince Trump that NATO is making good progress, the president insisted that even NATO's existing goals were insufficient.

"Two percent is the bare minimum for confronting today’s very real and very vicious threats," Trump said.

The 2 percent goal is more complicated than Trump's remarks indicated. Agreed at a NATO summit in Wales in 2014, the pledge calls for allies to move voluntarily toward spending 2 percent of annual GDP on defense, and also for 20 percent of that spending to be investments in equipment. The second provision is a way of ensuring that the new money helps increase military capacity, rather than just going, for instance, to higher salaries for existing soldiers.

Stoltenberg had hoped to send Trump on to the G7 talks in Sicily with two clear victories: a commitment that each country falling short on spending would develop a plan by the end of this year show how they would meet the target, and efforts to beef up NATO's role in fighting terrorism.

“We will agree to establish a new terrorism intelligence cell here at NATO headquarters,” Stoltenberg said Thursday morning. “Improving how we share intelligence, including on foreign fighters. And we will decide to appoint a coordinator to oversee NATO’s efforts in the fight against terrorism.”

Tom McTague contributed reporting.