PARIS — Donald Trump might be unhappy, but he can’t blame Europeans for listening to him.

The U.S. president’s Twitter tirade on Tuesday targeting Emmanuel Macron— attacking the French president for wanting to build a European army “to protect us against China, Russia and even the United States of America" — is just the latest in a series of spiky rebukes of his European allies.

But besides being evidence of Trump’s confrontational style — his tweets claimed the French were “starting to learn German” during World War II before the Americans came along — the ire they contain is misdirected.

Macron’s — and now German Chancellor Angela Merkel’s — desire to build a European army is a reflection that the Continent has woken up to the reality that it needs to stand on its own two feet, instead of relying on the U.S. on security.

And that’s exactly what Trump has said he wants.

With the European election looming on the horizon, Macron wants to prove a united, strong EU can protect its citizens.

Two years after his surprise election, Europeans are starting to take the U.S. president seriously — and literally. They’ve abandoned the hope he would represent a passing fad, or that personal relations would attenuate his policies. Instead, they’ve accepted they need to build a European response.

At Armistice Day commemorations in Paris last weekend, the Europeans came out looking well — celebrating multilateralism and dismissing nationalism as a “clear betrayal of patriotism.” Trump, meanwhile, resorted to Twitter attacks and canceled an appearance at a war veterans’ cemetery.

The events were also the backdrop to the first Paris Peace Forum, an ambitious event promoting cooperation on issues like climate change, nuclear proliferation and corruption — proving the Continent has the ambition to be a global leader.

Macron’s push for a European army fits into this larger effort. With the European election looming on the horizon, the French president wants to prove a united, strong EU can protect its citizens.

That includes making the case for shared borders, pooling defense efforts and promoting common trade policies that will make Europe more powerful on the world stage. The goal, in his own words is “a Europe that defends itself on its own, without depending solely on the United States and in a more sovereign way.”

The U.S. president should be celebrating that idea. Presidents before him, too, have repeated that America is spending too much to protect rich European allies.

Now Europe — and crucially, France — is finally listening.

Paris, often frustrated by the defense underinvestment of some its partners — notably Germany — knows Trump has a point. In the last year, Macron has pushed policies to share troops between European states to promote a convergence of European “strategic cultures.” More broadly, European efforts like the launch of PESCO and the European Defense Fund have helped to pool resources. There’s also a general increase in defense spending across the continent that predates Trump.

Europeans, in short, have reawakened to security issues. Russian aggression against Ukraine, ISIS-inspired terror attacks in Europe and the refugee crisis that resulted from the collapse of the Syrian and Libyan states have reminded Europe of its previous complacency on security matters.

Despite Trump’s attacks on allies, the U.S. military still carries the heavy load in reassuring Eastern Europeans against Russia.

France, which has troops in the Sahel to fight al-Qaeda in the Islamic Maghreb and in Estonia within NATO’s reassurance measures, has been at the forefront of the European response.

To the French at least, this is not just about Trump.

French strategists see him as a symptom, albeit a brutal one, of a deeper realignment of American power that started well before him, that will likely outlast him. The “America First” president’s agenda has only added a feeling of loneliness to Europeans’ growing sense of insecurity.

“This shift to isolationism, or rather unilateralism, is not new,” Macron told ambassadors in an August speech. The French policy elite is still traumatized by the events of 2013, when President François Hollande — who had military jets to stand by to strike the Syrian regime’s chemical facilities — received a call from President Obama announcing that the U.S. was reneging on the strikes.

“We didn’t forget Syria,” a French intellectual close to the Elysée told me in Paris this week. “I hate Obama.”

From Obama’s non-intervention to Trump’s withdrawal of the Iran deal, compelling European companies to divest in Iran, the two recent administrations have underscored Europe’s weaknesses and over-reliance on Washington.

That’s why France doesn’t see efforts to increase European security independence as being in competition with NATO. The end goal is to create a more mature and balanced partnership in the long run.

This will take more than a few speeches. For all the high-profile attendees at the Paris forum, Syria, Ukraine and Libya went unmentioned. This isn’t surprising: It’ll take a generation to catch up on Europe’s military shortcomings.

Despite Trump’s attacks on allies, the U.S. military still carries the heavy load in reassuring Eastern Europeans against Russia. And in Europe, the road to bridging divisions — as we’ve seen when it comes to other issues, like migration and national budgets — is long and rocky.

But at the very least, a serious conversation has started. Trump should be cheering.

Benjamin Haddad is a fellow at Hudson Institute in Washington, D.C. He worked on Emmanuel Macron’s 2017 presidential campaign.