BRUSSELS – President Donald Trump on Thursday publicly scolded European allies for taking advantage of U.S. taxpayers by failing to spend enough on defense ― while in private reportedly breaking with them over how to treat Russia, the country that worked to help get him elected.

“NATO members must fully contribute their fair share and meet their financial obligations,’’ he said at a ceremony intended to mark the alliance’s solidarity in responding to the 9/11 attacks on America.

“Twenty-three 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. “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.”

Trump spoke at NATO’s sparkling new headquarters building at the dedication of a memorial to the victims of the Sept. 11 terrorist attacks ― the only time in the alliance’s 68-year history it invoked the “Article 5” promise that an attack on one was the same as an attack on all.

Trump briefly acknowledged the military assistance NATO has provided in the war in Afghanistan, but spent more than a quarter of his eight-minute speech criticizing the alliance’s nations as several of their elected leaders stood by with uncomfortable looks on their faces.

Trump said he has been “very, very direct’’ with NATO Secretary General Jens Stoltenberg and alliance members in saying that the they “must finally contribute their fair share and meet their financial obligations.”

“Over the past eight years, the United States spent more on defense than all other NATO countries combined,” he said.

By referring to countries owing “massive amounts of money,” though, Trump incorrectly described the nature of the organization. NATO does collect relatively modest dues for the operation of its headquarters and other largely administrative functions. But the collective defense component comes through the member nations collecting taxes from their own citizens to pay for their own militaries, which then work together.

The concept of “burden-sharing,” where other NATO members would increase their own defense spending, has been a U.S. priority long before Trump took office, and in fact became formalized in 2014.

That year, following the declaration of a “caliphate” by the Islamic State terrorist group in Syria, immediately adjacent to NATO member Turkey, NATO agreed that each nation would ramp up its defense spending to 2 percent of its economy over the coming decade.

Trump termed the 2 percent figure “insufficient to close the gaps in modernizing readiness and the size of forces.”

During his presidential campaign, Trump repeatedly criticized NATO and went so far as to suggest it could be dissolved as “obsolete” because the Cold War had ended ― a view aligned with Russian leader Vladimir Putin’s criticisms of the alliance through the years.

Indeed, if Russia had hoped to drive a wedge between the U.S. and western Europe with its support of Trump’s candidacy, that strategy appears to be paying off.

European Council President Donald Tusk told reporters after a private meeting with Trump earlier Thursday that Russia appears to be an issue that will divide the U.S. and its traditional European allies.

“I’m not 100 percent sure we can say that we have a common position, a common opinion on Russia,” Tusk said, according to a report by the BBC. “Although when it comes to the conflict on Ukraine, we were on the same line.”

In his remarks at the memorial dedication, Trump only in passing mentioned Russia. “The NATO of the future must include a great focus on terrorism and immigration as well as threats from Russia and on NATO’s eastern and southern borders,” he said.

The bulk of the rest of his remarks focused on combatting Islamist terrorism.

The White House’s three-paragraph readout of Trump’s meeting with Tusk and European Commission President Jean-Claude Juncker said the three discussed ISIS, North Korea and trade, but did not mention Russia. The White House press office did not immediately respond to a query regarding Tusk’s reported statements.

U.S. intelligence services agree that their Russian counterparts covertly worked to harm the candidacy of Democratic presidential nominee Hillary Clinton and to support Trump. Their tactics included stealing emails from Democrats and releasing embarrassing ones through WikiLeaks, the intelligence services have concluded.

Trump denies he knew anything about the assistance or that he colluded with Russians during the campaign. He did, however, fire FBI Director James Comey and cited the FBI’s probe into Russian meddling as a reason. And Comey in an internal memo said that Trump during a private meeting asked him to drop the FBI’s investigation into the president’s first national security adviser, Michael Flynn, over his contacts with Russia. Flynn was forced to resign after less than a month in his post after he misled Vice President Mike Pence about those contacts.

Trump is scheduled to meet with the most prominent of the NATO allies he just criticized at Friday and Saturday’s meeting in Sicily of the G7, which is made up of highly industrialized democracies. Also known as the G7, it includes Germany, France, the United Kingdom and Italy.