After watching the G7 train wreck aghast, senior officials at NATO headquarters are quaking in their boots at the prospect of hosting a summit of the Western defense alliance featuring a raging Donald Trump in Brussels.

Far from showcasing transatlantic unity and resolve, they fear the 24-hour gathering of leaders of the 29-nation alliance, scheduled for about a month from now, could turn into round 2 of the rumble in Quebec, with the U.S. president on the rampage against the Europeans and Canadians over their allegedly unfair trade surpluses and puny military spending, leaving NATO in tatters.

It is entirely legitimate for the United States to press NATO nations to pay more toward their own defense. But America needs like-minded friends and allies, and Trump cannot afford to go on treating them as rivals or threats to its security.

And yet … Just look at what happened in the aftermath of the G7. For the U.S. to withdraw its signature from an agreed joint statement of the world’s seven leading advanced economies is unprecedented. For its president to publicly accuse his host, Canadian Prime Minister Justin Trudeau, of being “very dishonest and weak” and his partners of robbing American workers is stunning.

Financial markets took the G7 shock in their stride, seemingly unfazed by the intrusion of reality TV tactics into global economic diplomacy. Despite the risk of a tit-for-tat trade war ignited by U.S. tariffs on imported steel and aluminum, with the threat of punitive levies on automobiles to come, many investors still believe Trump’s economic bark is worse than his bite.

NATO can normally be relied upon to stage-manage a tightly drilled meeting, replete with photo opportunities to illustrate transatlantic solidarity.

However, a bust-up at the July 11-12 NATO summit could have more severe strategic implications, especially if it emboldens countries such as Russia, China or Iran to try to exploit Western divisions with potentially dangerous consequences for war and peace.

At stake is the future of an alliance that has preserved Western stability and prosperity for the last seven decades, but which Trump as a candidate has branded “obsolete.”

Unlike rambling European Union summits, where final agreement is often uncertain and leaders have an incentive to play to the domestic gallery, NATO can normally be relied upon to stage-manage a tightly drilled meeting, replete with photo opportunities to illustrate transatlantic solidarity and a pre-cooked communiqué full of gift-wrapped “deliverables.”

At NATO, European leaders mostly stick to constructive talking points, eager to stand together as a united transatlantic family with shared values behind the “leader of the free world,” as the U.S. president used to be called.

The unpredictable Trump drove a tank through that choreography last year, refusing to stick to his script by deliberately omitting the Article V mutual defense pledge that aides had written into his prepared speech, and instead haranguing the Europeans over their feeble military expenditure.

“We had shortened the meeting for him and arranged a series of ‘wins’ on defense spending, counterterrorism and cybersecurity,” said a person involved in preparing last year’s encounter with Trump. “He simply pocketed the concessions, didn’t mention Article V and beat up on the allies anyway.”

In an attempt to avoid another divisive spectacle next month, NATO has lined up a new basket of “wins” for which Trump can claim credit:

— A rising trend in defense spending among almost all allies.

— A bigger slice earmarked for modernizing equipment and improving readiness, with the EU budget being used for the first time to fund military research and development.

— An EU initiative to facilitate “military mobility” by removing administrative barriers and

upgrading roads, bridges and railways to help NATO get its tanks, trucks, troops and aircraft across Europe to the eastern front faster in a crisis.

— The opening of a NATO program in Baghdad to train Iraqi security forces to fight the Islamic State.

“The U.S. pays close to the entire cost of NATO — protecting many of these same countries that rip us off on trade (they pay only a fraction of the cost — and laugh)" — Donald Trump

But the cast of characters in Brussels is mostly the same as it was in Canada, and the bad blood from La Malbaie will still be fresh. Trump’s erratic behavior — and his obsession with linking trade flows and defense outlays — shows that no amount of ground-laying can protect the alliance from self-inflicted damage by the American leader.

The big debate now in the European strategic community is over how to respond when your guardian superpower goes rogue — not only on rules-based trade but by disregarding allied views and going it alone on Iran, the Israeli-Palestinian conflict, climate change and the United Nations.

NATO Secretary-General Jens Stoltenberg, whose job is to prevent the transatlantic elastic from snapping, is urging allies to focus on the “three Cs” — cash, capabilities and commitments — to show how they contribute to the common defense beyond the headline goal of 2 percent of gross domestic product. But Trump only seems to care about the first C, and he’s mad as hell, especially at affluent Germany.

“The U.S. pays close to the entire cost of NATO — protecting many of these same countries that rip us off on trade (they pay only a fraction of the cost — and laugh),” he roared in a tweet this week.

Faced with a U.S. president who considers the number of Mercedes on Fifth Avenue a national security threat but is loath to criticize Russian military intervention in Ukraine, the Europeans are torn between the urge to hit back — at the risk of further tearing the fabric of transatlantic relations — and the instinct to grin and bear it because we still need America to keep us safe.

France, Germany and Britain agree in principle on the need to retaliate firmly but politely to U.S. trade bullying and to stick to the Iran nuclear accord. But there’s also potential for splits among Europeans, with populist governments in Italy and Poland inclined to seek national advantage by appeasing Trump.

After French President Emmanuel Macron’s attempts to seduce Trump were jilted, Paris sees an opportunity to push for European “strategic autonomy” — the ability to conduct military operations without U.S. support if necessary, and to build weapons without U.S. technology.

Maintaining a successful defense alliance also requires not shooting at your own allies. With four weeks until the Brussels NATO summit, that is anything but certain.

But many Europeans, especially those closest geographically to Russia, see the notion of “strategic autonomy” as a dangerous illusion and oppose sending any signal that could give Trump an excuse to back out of the Atlantic alliance. German Chancellor Angela Merkel’s is understandably among the cautious, despite her talk of Europe taking its fate into its own hands, because her country has more to lose commercially and is more squeamish about military action.

U.S. and NATO officials urge the Europeans to look past Trump’s tweets — at what his administration is actually doing. “Follow the money,” U.S. Defense Secretary James Mattis counseled NATO colleagues at a recent meeting.

The U.S. has more than doubled its budget allocation for its European Deterrence Initiative, deployed tanks back into Europe for the first time since the end of the Yugoslav wars of the 1990s, reactivated a naval command for the Atlantic, and prepositioned equipment in Eastern Europe. Despite Trump’s reluctance to criticize President Vladimir Putin, the U.S. has stepped up sanctions against Moscow after the poisoning of a former Russian spy in Britain with a nerve agent.

All good signs, yes. But maintaining a successful defense alliance also requires not shooting at your own allies. With four weeks until the Brussels NATO summit, that is anything but certain.

Paul Taylor, contributing editor at POLITICO, writes the Europe At Large column.