BRUSSELS — President Trump wasted no time. NATO’s secretary general, Jens Stoltenberg, could barely finish the protocol greetings at Wednesday’s breakfast when Mr. Trump launched into a clearly preplanned attack on Germany, its level of military spending and dependence on Russia for natural gas.
In a harsh rebuke at the opening of the NATO summit meeting, Mr. Trump called Germany “totally controlled” and “captive to Russia” because of energy dependency and for a new pipeline, Nordstream II, that would double the amount of gas Russia can send directly to Germany while bypassing Ukraine and Poland.
“Germany, as far as I’m concerned, is captive to Russia because it’s getting so much of its energy from Russia,” Mr. Trump told the startled Mr. Stoltenberg. “We have to talk about the billions and billions of dollars that’s being paid to the country we’re supposed to be protecting you against.”
“I think it’s something that NATO has to look at,” Mr. Trump said.
Chancellor Angela Merkel of Germany, politically weakened at home, reacted mildly but pointedly to Mr. Trump’s remarks, having grown up in Soviet-occupied East Germany. “I myself experienced a part of Germany that was controlled by the Soviet Union, and I am very happy today that we are united in freedom as the Federal Republic of Germany,” she said as she entered the NATO building. “We decide our own policies and make our own decisions, and that’s very good.”
Germany’s foreign minister, Heiko Maas, gave a much sharper response, writing on Twitter that saying, “We are no captives — neither of Russia nor of the United States.”
In the private meeting that followed, participants said, Mr. Trump repeated his demand that the NATO allies rapidly increase their military expenditures to the NATO guideline of 2 percent of gross domestic product. Under the current plan, they have until 2024 to reach that level.
He also surprised the participants by suggesting that the alliance should commit to lifting future spending to 4 percent of G.D.P., the Lithuanian president, Dalia Grybauskaite, said in a brief interview. She said the tone of the meeting was calm and conciliatory.
The United States currently spends only 3.5 percent of G.D.P. on its military.
Nor was there any great controversy over the NATO communiqué, which was issued by consensus. That was a departure from the G-7 meeting in Canada last month, when Mr. Trump renounced his approval of the communiqué, calling the host, Prime Minister Justin Trudeau, “weak&dishonest” in a Twitter post.
After the meeting, Mr. Stoltenberg said that it was important first to focus on getting spending levels to 2 percent before worrying about a higher figure. “We agreed to pledge to 2 percent. Let’s start with that. And we have a way to go.”
By charging that Germany is in thrall to Moscow, Mr. Trump appeared to be attempting to deflect criticism that he is too accommodating toward President Vladimir V. Putin of Russia, who he meets on Monday in Helsinki, Finland, suggested Derek Chollet, a former assistant secretary of defense who is now with the German Marshall Fund in Washington.
“This is like throwing a match on kindling, since Germany was anticipating something like this after the Group of 7” meeting in Canada, where Mr. Trump was similarly mocking, but in private, Mr. Chollet said. “Trump went out of his way in his first meeting to send this unprovoked attack.”
Mr. Trump and Ms. Merkel talked later in a bilateral meeting that lasted an hour, and appeared to go out their way to be cordial, even though it is widely known that they have a strained relationship.
Ms. Merkel, fact-based and unemotional, was a strong ally of President Barack Obama, which is a source of friction with Mr. Trump. German officials say that when the two leaders speak on the phone, Mr. Trump harangues her at the start about military spending and the trade surplus almost before the usual pleasantries and the main substance of the call.
“We have a very, very good relationship with the chancellor, we have a tremendous relationship with Germany,” Mr. Trump said. “We’re having a great meeting. We’re discussing military expenditure, we’re talking about trade.” Noting Germany’s “tremendous success,” Mr. Trump added: “And I believe that our trade will increase and lots of other things will increase, but we’ll see what happens.”
Asked if the pipeline issue had come up, Mr. Trump said that it had. For her part, Ms. Merkel was nonconfrontational. “I am pleased to have this opportunity to be here for this exchange of views,” she said, which extended to economics, migrations and “the future of our trade relations.” She concluded: “We are partners, we are good partners, and wish to continue to cooperate in the future.”
Mr. Trump had been advertising his intention to read the Riot Act to NATO allies about military spending, calling Americans “the schmucks that are paying for the whole thing” and vowing last week: “I’m going to tell NATO — you got to start paying your bills. The United States is not going to take care of everything.”
But his animus toward Germany, which spends only about 1.24 percent of its G.D.P. on defense and has a large trade surplus with the United States, came out in fierce and startling terms. Mr. Trump has regularly criticized Germany for what he has described as the prevalence of German-made cars on American streets and for taking advantage of American largess to spend less on defense and more on education and social welfare. He has threatened the European Union with new tariffs on imported cars, as well as those already imposed on steel and aluminum.
But in the meetings on Wednesday, Mr. Trump refrained from mentioning trade issues and framed his criticism on more purely security terms.
“I have to say, I think it’s very sad when Germany makes a massive oil and gas deal with Russia where we’re supposed to be guarding against Russia,” Mr. Trump went on. “We’re supposed to protect you against Russia but they’re paying billions of dollars to Russia and I think that’s very inappropriate.”
The Nordstream II pipeline project has been opposed by the United States for many years, including under President Obama, as well as by some European countries, like Poland, that warn it will give Russia too much leverage.
Nordstream II would add two pipelines to the existing Nordstream pipeline and increase overall annual capacity to 3.9 trillion cubic feet.
The Germans argue that they have been diversifying their gas supplies, that they now get only about 9 percent of their energy from Russia — not the 70 percent that Mr. Trump claimed — and that Washington is angling to sell liquid natural gas to Germany instead.