President Donald Trump's time in office has been characterized by a seeming disdain for NATO.

In a March meeting, Trump reportedly joked about ending the US's membership in the alliance.

The US continues to work with NATO, but officials on both sides of the Atlantic worry about fraying ties.

During a private meeting with President Donald Trump in March, Swedish Prime Minister Stefan Lofven explained that while his country was not a member of NATO, it regularly partnered with the defense alliance.

Trump, who has clashed with NATO leaders since taking office, responded by saying that was the kind of relationship with NATO that the US should consider, a European diplomat told Washington Post columnist Josh Rogin.

A senior administration official told Rogin that the remark was a joke, but the comment is one of many before and since that hint at disinterest, and, in some cases, hostility from the US president toward the trans-Atlantic alliance of which the US was a founder and is the largest member.

The US is the most powerful military in the 29-member alliance, and US withdrawal would dramatically reduce NATO's power to deter potential adversaries like Russia at a time when Russian President Vladimir Putin is using cyberattacks and his military to threaten European neighbors.

Trump's criticisms have centered around financing, and he has often rebuked NATO members for falling short of the 2%-of-GDP defense-spending level to which alliance members have agreed.

President Donald Trump with NATO Secretary General Jens Stoltenberg, third left, and Vice President Mike Pence, right, at a meeting in the White House, May 17, 2018. Andrew Harrer-Pool/Getty Images

He reiterated that criticism in letters sent to some of the NATO members that fell short of that spending threshold in the weeks ahead the organization's summit on July 11 and July 12.

The only one to be made public was sent to Norwegian Prime Minister Erna Solberg. The June 19 letter, published by Norwegian newspaper VG, said Norway was "the only NATO Ally sharing a border with Russia that lacks a credible plan to spend 2 percent of its gross domestic product on defense."

In the letter, Trump said he "understand[s] domestic political pressures," having faced them in the US, but it would "become increasingly difficult to justify to American citizens why some countries continue to fail to meet our shared collective security commitments."

The letter followed a general template, tailored with language specific to the recipient country, US and foreign officials told Foreign Policy. The officials said the letter sent to Germany contained some of the harshest language —Trump himself has directed some of his most withering scorn at German Chancellor Angela Merkel.

Defense Secretary Jim Mattis at a news conference during a NATO defense ministers' meeting in Brussels, Belgium, February 15, 2018. Reuters

Concerns about Trump's commitment to the alliance have grown during his second year in office, especially as he continues to criticize NATO leaders and pursue rapprochement with Russian President Vladimir Putin.

Many of the Trump administration officials who tried to reassure NATO allies have departed.

NATO officials are also worried by what seems to be the increasing isolation of Defense Secretary Jim Mattis, who is regarded as one of the administration's steadier hands and a vocal NATO proponent.

Julianne Smith, director of the Trans-Atlantic Security Program at the Center for a New American Security, told The New York Times that Trump questioned other leaders about their opinions of Mattis during the G7 meeting in Canada in May.

Smith, who was deputy national security adviser to former Vice President Joe Biden, said the exchange was "awkward" for those leaders, who felt praise "might be the kiss of death" for Mattis. "So they said deliberately that he is being so tough on us on 2% defense spending, to try to save the guy."

"There’s overwhelming anxiety, and it's been punctuated with very specific concerns. That has a profound impact on what our Europeans friends think he thinks about them," Biden told Rogin. "The consequence is disastrous for our national security and economic interests."

The US continues to back NATO and its initiatives, particularly the alliance's efforts to counter Russia.

US troops, part of a NATO mission to enhance Poland's defense, before an official welcoming ceremony in Orzysz, northeastern Poland, April 13, 2017. Associated Press

The US remains an active participant in NATO military exercises, leads one of the multinational battle groups now deployed to Eastern Europe, and has volunteered to host NATO's new Atlantic Command in Norfolk, Virginia, to oversee operations in the northern Atlantic.

The bloc also recently agreed to the NATO Readiness Initiative, a plan pushed by Mattis requiring NATO to have 30 land battalions, 30 fighter aircraft squadrons, and 30 warships ready to deploy within 30 days of being put on alert.

But continued cooperation doesn't mean the ties established between North America and Europe since the end of World War II will endure, NATO Secretary General Jens Stoltenberg said this month.

"It is not written in stone that the trans-Atlantic bond will survive forever," Stoltenberg said in London. "But I believe we will preserve it."

"We may have seen the weakening" of some of those bonds, Stoltenberg said. He added that differences had been overcome in the past and said maintaining the partnership "is in our strategic interests."

"We must continue to protect our multilateral institutions like NATO, and we must continue to stand up for the international rules-based order," he said.