After four long years of Donald Trump’s attacks on NATO, Secretary General Jens Stoltenberg said Thursday that the defense alliance had survived the challenge — and that he looked forward to rebuilding the transatlantic relationship with President Biden.

“There is a need to rebuild trust between Europe and the United States,” Stoltenberg said in an interview. “I don’t believe in ‘America alone.’ I don’t believe in ‘Europe alone.’ I believe in North America and Europe together.”

Trump had many targets for his anger during his term in the White House, and NATO allies were frequently in the crosshairs. He said they took advantage of the United States and slacked off on defense spending. He criticized the national character of one NATO member as “very aggressive” and said it could drag the United States into World War III. He embraced Russian President Vladimir Putin and literally shoved aside the prime minister of Montenegro at one NATO summit. At another meeting, in 2018, he threatened to pull the United States from NATO if allies did not cough up more money for defense on the spot.

“It is no secret that we had, I had, difficult discussions with him on issues ranging from arms control, Russia, burden sharing and many other issues,” said Stoltenberg, who cracked a smile when asked what was going through his head as he watched Wednesday’s inauguration but mostly declined to criticize Trump directly.

Trump “said that the alliance was obsolete and then he said it was no longer obsolete. He said that he was committed to NATO, but then he also questioned the U.S. commitment to it, to our collective defense guarantees,” Stoltenberg said. “For me, it was important to do whatever I could to keep this alliance together.”

Some NATO diplomats say that the alliance for years was transformed into an engine that was focused primarily on keeping Trump happy and avoiding triggering a White House effort to quit the club. NATO defense spending has been increasing since 2014 — but during the Trump years, Stoltenberg touted only the increases that had happened since Trump’s election in 2016, as a way to appease the U.S. president and give him bragging rights about changing what he deemed NATO’s freeloading ways.

Allies burned hours on largely symbolic efforts to reduce U.S. contributions to the core budget that keeps the lights on and pays some employees at NATO headquarters, a fraction of overall member spending on defense. NATO member Turkey, meanwhile, was emboldened by Trump’s affinity for its increasingly autocratic president, Recep Tayyip Erdogan, and took steps to block alliance business to get concessions on unrelated Turkish priorities.

Stoltenberg said he didn’t choose with whom to work.

“President Trump was elected president of the United States. And it was necessary to work with him, as it has been important to work with President Obama in the first years of my tenure and now work with President Biden,” he said.

One Trump move that drew a rare rebuke from Stoltenberg was a November decision to accelerate a withdrawal of U.S. forces from Afghanistan. NATO allies with troops there say they were not consulted before Trump issued the order shortly after he lost the election. A peace deal with the Taliban foresees a full U.S. withdrawal by May 1, although it is unclear how Biden will proceed.

“There is no way to deny that we are faced with a difficult dilemma in Afghanistan. No one wants to stay any longer in Afghanistan than necessary,” Stoltenberg said. “At the same time, we need to preserve the gains we have made with such high sacrifices over the last decades and prevent Afghanistan from becoming once again a safe haven for international terrorists. But it’s not an easy decision.”

Stoltenberg said he welcomed the inauguration of Biden and Vice President Harris.

“It was a great thing to see how democracy prevailed, because we were all shocked and outraged by the attacks on the Capitol,” he said, referring to the Jan. 6 riot there by a pro-Trump mob. “Every inauguration is a demonstration of the strength of the American democracy. But this time, it was even more important to see how democracy prevailed and how a peaceful transition took place.”

Birnbaum reported from Riga, Latvia.