LONDON — Donald J. Trump’s statement that the United States might not come to the defense of NATO allies that do not foot their share of the bill fueled anxiety on Thursday in a Europe that is already deeply unsettled about Russia’s assertive posture, Britain’s decision to withdraw from the European Union and the rise of inward-looking populist and nationalist parties.

In an interview with The New York Times, Mr. Trump suggested that if elected president he would use a country’s level of military spending as a factor in deciding whether the United States would honor its commitment to defend any member nation that comes under attack. While President Obama and other American officials have also pressed European countries in recent years to increase military spending in line with their commitments to NATO, Mr. Trump more explicitly linked financial considerations to the strategic response he would order as president in the event of an attack by Russia.

His comments left some European officials concerned that the United States under Mr. Trump would edge away from the security guarantees that Washington has provided to the Continent since World War II. But they also stoked the debate over cost sharing after years in which Europe had been slow to meet its commitments on military spending.

Jens Stoltenberg, NATO’s secretary general and a former prime minister of Norway, said that he “will not interfere in the U.S. election campaign,” but made clear that he was alarmed by Mr. Trump’s remarks.