President Trump is serving up intense whiplash on NATO while in London for the summit this week — a reversal transparently related to his ongoing trouble on the home front.

Trump has gone from labeling the agreement “obsolete” and earlier this year privately mulling a U.S. withdrawal from the alliance, to outright praising the 29-country alliance. Before he departed the White House on Monday, Trump called the NATO summit one of his “most important journeys” as president and criticized Democrats for scheduling and inviting him to a “hoax” impeachment hearing while he’s away.

The contradictions only escalated from there. Upon his arrival in London, Trump berated French President Emmanuel Macron for his condemnation of the alliance as “brain dead” and called Macron’s remarks “very, very nasty” and even “dangerous.”

“I think that’s insulting to a lot of different forces, including a man that does a very good job at running NATO,” Trump said, speaking to reporters alongside NATO Secretary General Jens Stoltenberg on Tuesday morning. “It’s a tough statement, when you make a statement like that, that is a very, very nasty statement to essentially, including them, 28 countries. … Nobody needs NATO more than France.”

Tensions rose when Trump and Macron sat down for a joint appearance later on Tuesday, when Macron defended his “brain dead” remark. He argued that the U.S. has “over-invested decade after decade” in the alliance and said he felt that there needed to be a strong “European component in NATO.”

And Trump doubled down on his praise of the agreement, arguing that the he’s a bigger fan of NATO now that, as he claims, more countries are contributing to the cause. He suggested that most countries are “really stepping up” their contributions and even threatened trade retaliations against those that didn’t.

“NATO’s come a long way in three years, it’s become very powerful, it’s become much fairer,” he said, suggesting that his past criticism of the alliance has had an impact on countries’ contributions to support it. But according to Stoltenberg, while there’s been a steady increase in spending on NATO from other countries, only seven of the 29 members are paying their full share of the agreement. Spending from NATO members increased in 2018 for the fourth year in a row, but the U.S. is still paying the lion’s share of the budget — 69 percent.

As his lawyers blame Trump’s impending no-show on the summit, the rationale behind Trump’s pivot to praise an alliance he spent the majority of his presidency insulting suggests he’s desperate for a distraction.