WE DON’T blame America’s European allies for fretting about the Trump administration’s impact on their security. Far too much for anyone’s comfort, President Trump has talked up U.S. relations with Russia and talked down its long-standing commitment to the North Atlantic Treaty Organization, calling it an “obsolete” alliance, whose non-U.S. members “aren’t paying what they should.” And all of that is not to mention Europe’s angst about making common cause with a president who seems to have a very different notion of Western values than his predecessors did — or the Europeans do.

Mr. Trump’s words regarding NATO have been sloppy and unwise, and the reassuring message Mr. Trump’s defense secretary, Jim Mattis, offered in Brussels last week offset them only somewhat. Yet in a way, Europe was warned: In 2011, Robert Gates, secretary of defense under President Barack Obama, told a Brussels audience that the transatlantic allies’ failure to keep up their military spending could lead to a U.S. backlash against them, or even abandonment. “If current trends in the decline of European defense capabilities are not halted and reversed,” Gates said, “future U.S. political leaders . . . may not consider the return on America’s investment in NATO worth the cost.” To this day, however, only two major NATO nations except for the United States spend 2 percent of their economic output on defense, as the alliance expects.

Among the worst offenders is Europe’s richest and most influential country, Germany, which spends about 1.2 percent of output — a lower percentage than Portugal’s. Of the $100 billion needed for Europe and Canada to meet their annual defense obligations, $30 billion would have to come from Germany, according to former NATO official Fabrice Pothier. To be fair, the 2 percent benchmark is a bit arbitrary; it can include items that don’t affect current capabilities, such as military pensions. What’s more, Berlin has been ramping up spending in recent years, despite its own public’s attachment to pacifism and fiscal discipline, and despite the need not to frighten its neighbors, who have long memories about the last time a unified Germany expanded its military power.

For all that, when Mr. Mattis instructed the European allies to do more last week, he was only telling them to act in their clear self-interest. There are two possibilities: The first is that the Trump administration’s assurances of support for NATO, which Mr. Mattis repeated, are insincere, in which case Europe will soon need more independent capability against Russia and other threats. The second is that transatlantic ties are and will remain strong and Mr. Trump is simply trying to cut a better deal so as to enhance the alliance’s legitimacy with an increasingly skeptical American electorate. Either way, Europe would be wise to hedge by accelerating investment in its long-neglected capabilities. It is a good sign that German Defense Minister Ursula von der Leyen promised more spending in response to Mr. Mattis’s plea. “The U.S. is right,” Ms. von der Leyen said, referring to the country, not its leader. She, too, was right.