NATO Secretary-General Jens Stoltenberg speaks in London on December 3, 2019 | Tobias Schwarz/AFP via Getty Images Jens Stoltenberg’s (Trump) mission accomplished US president heaps praise on NATO and its secretary-general while slamming Macron and France.

LONDON — It's mission accomplished for Jens Stoltenberg — at least as far as Donald Trump is concerned.

After the 2016 U.S. election, the NATO secretary-general made a top priority of managing the views and expectations of the combustible president, working assiduously to convince him that the alliance is not "obsolete" — as Trump famously declared on the campaign trail.

By spring 2017, Stoltenberg had rescued NATO from obsolescence, and stood alongside Trump at a news conference where the president declared: "It is no longer obsolete."

But with Trump pounding angrily on NATO allies to increase their military spending, the situation remained touch-and-go. At a NATO leaders' summit in Brussels in July 2018, Trump unleashed mayhem by threatening to pull the U.S. out of the alliance.

Early in 2019, with fears mounting that Trump would use his annual State of the Union speech to again bash NATO, Stoltenberg made a dash to Washington, where he gave an interview on Fox News, Trump's favorite station, to trumpet a sharp increase in military spending by allies and give Trump credit. The $100 million figure he cited went straight into the president's speech.

With Trump pounding angrily on NATO allies to increase their military spending, the situation remained touch-and-go.

On Tuesday, however, there was no doubt that NATO's top civilian leader had achieved his goal — though perhaps not quite as he had intended — as Trump took up the NATO banner to denounce recent criticism by French President Emmanuel Macron.

Arriving in London for a leaders' summit to celebrate NATO's 70th anniversary, Trump used a morning meeting with Stoltenberg to heap praise on the secretary-general and the alliance, while slamming Macron's remarks as "nasty" and "disrespectful" and then generally turning his ire on France.

"I think he's doing a fantastic job," Trump said of Stoltenberg. "I am a big fan. His contract was extended. I am very happy about that. You really earned it. You are doing a fantastic job. We appreciate it. I think the secretary-general will tell you that through some work and some negotiation, we've increased the budget of countries other than the U.S.A. because we are paying far more than anybody else, and far more even as a percentage of GDP."

Trump adding the spending "was going down for close to 20 years. If you look at a chart, it was like a rollercoaster — down, nothing up — it was going on for a long time. You wouldn't have had a NATO if you kept going that way. Now, we've increased it incredibly well. I am happy to have helped."

Stoltenberg returned the favor, praising Trump for putting pressure on allies to spend more on their militaries.

"Your leadership on defense spending is having a real impact," Stoltenberg said. "Since 2016, Canada and European allies have added $130 billion more to their defense budgets, and this number will increase to $400 billion by 2024. This is unprecedented. This is making NATO stronger, and it shows this alliance is adapting, responding when the world is changing."

Macron's advisers have suggested that part of the French president's goal in criticizing NATO was to steal some of Trump's thunder, and prevent the American from dominating the summit with more bluster about military spending. On that front, Macron may have succeeded.

For Stoltenberg, it was easy to spin the moment into gold.

The appearance with Trump allowed the secretary-general to answer some of Macron's substantive criticisms. He said NATO leaders would use the London summit to address many issues Macron has said need to be higher priorities.

"We will of course also address a wide range of other issues, including the fight against terrorism, arms control, our relationship with Russia, the rise of China," Stoltenberg said. "NATO is the most successful alliance in history because we have been able to change when the world is changing. That is exactly what we are doing again."

Trump loved it. "That's a very profound statement and a statement that everybody has to understand is important to me," he said.

"NATO is the most successful alliance in history because we have been able to change when the world is changing" — Jens Stoltenberg

When a reporter asked about Macron's "brain death" remark, Trump was ready to pounce.

"And then Turkey responded by saying that he was brain dead, which was interesting," Trump said, almost snickering.

Then he offered the monologue that Stoltenberg has been working for three years to achieve.

"NATO serves a great purpose," Trump said. "It got to be unfair for the United States, because the United States was paying a disproportionate amount and I heard that President Macron said NATO is brain dead. I think that's very insulting to a lot of different forces, including a man who does a very good job running NATO ... It has a great purpose, especially with the fact that NATO is becoming much more flexible in terms of what it looks at."

Trump then turned to Stoltenberg, saying: "I would like to ask you what you think, he made a statement about NATO being brain dead." Trump nearly growled as he said those last two words.

That allowed Stoltenberg to offer his most expansive rebuttal yet of the French president's remarks.

"That's not the case," he began, waving his arms. "Because NATO is active. NATO is agile. NATO is adapting. And we have just implemented the largest reinforcement of collective defense since the end of the Cold War, with high readiness of our troops. For the first time in our history, we have combat-ready troops in the eastern part of the alliance. European allies and Canada are investing more, also in high-end capabilities. And we are stepping up the fight against terrorism, and we are as an alliance for the first time also addressing the security implications of the rise of China. So the reality is this alliance has proven once again the ability to adapt to change."

Trump used that to pivot to an attack on France. "I think that, you know, you have a very high unemployment rate in France. France is not doing well economically at all. They are starting to tax other people's products. So therefore we are going to tax them ... wines and everything else."

He added: "You look at what's happened with the Yellow Vests, or you look at what's going on with certain parts of their season ... you just can't go around making statements like that about NATO. It's very disrespectful."