President Donald Trump shakes hands with Turkish President Recep Tayyip Erdogan in the Roosevelt Room of the White House, Tuesday, May 16, 2017, in Washington. (AP Photo/Evan Vucci)

Editor’s Note: Frida Ghitis, a former CNN producer and correspondent, is a world affairs columnist. She is a weekly opinion contributor to CNN, a contributing columnist to The Washington Post and a columnist for World Politics Review. The views expressed in this commentary are her own. View more opinion on CNN.

CNN  — 

Former President Donald Trump and Turkish President Recep Tayyip Erdogan, perhaps two of the world’s most prominent and controversial authoritarian leaders, are fighting for their political lives.

Frida Ghitis

Their fates will reverberate across the globe, shaping history. Among other consequences, the impact will go a long way in determining the future – perhaps even the survival – of NATO, the military alliance of democracies that seemed on the verge of unraveling just a few years ago and now looks as strong and purposeful as it has in decades.

This Sunday, Turkish voters will decide if, after 20 years of increasingly autocratic rule, they want to reelect Erdogan, a man whose democratic credentials are as questionable as his commitment to NATO.

Then there’s the former US president, who in a CNN town hall this week reminded the world that American foreign policy, its relations with allies and the quality of its democracy could be upended if he returns to power after the 2024 election.

No president since World War II has done more to undermine the NATO alliance than Trump did. And no current member has equivocated more about his allegiance to NATO’s goals than Erdogan has.

Trump’s televised performance was a vertigo-inducing flashback to the days of his presidency, when his interactions with allies were disruptive, disrespectful and profoundly damaging to the alliance and to global security. Damaging because when malign global players see the US and NATO as a barrier to their aggression, they are less likely to go on the attack.

That’s why even though Trump claimed Russia would not have invaded Ukraine if he were president, it’s more likely his actions contributed to Russian President Vladimir Putin’s belief that NATO would not get in his way, making him think he could succeed.

Today, NATO’s most crucial mission is supporting Kyiv in its existential effort to repel aggression from Russia, a country whose leader falsely claims Ukraine is not a real country. Putin has made similar suggestions about former Soviet republics – which include NATO members Estonia, Latvia and Lithuania – now also feeling threatened.

When asked in the town hall if he wants Ukraine to win the war, Trump said he just wants the fighting to stop, refusing to say if he wants Ukraine or Russia to prevail. And that’s despite the fact that Putin’s unprovoked invasion has been conducted with such brutality that the International Criminal Court has issued an arrest warrant for him.

Eighteen months before the 2024 election, America’s European allies are experiencing a familiar angst. Can they trust the United States as an ally?

Trump said the US is giving too much to Ukraine. As in the old days, one could almost picture Putin’s face breaking into a grin hearing Trump speak.

As president, Trump reportedly pondered pulling the US out of NATO. He moved to cut US contributions to its budget. His former national security adviser, John Bolton, said he might have left NATO if he had won in 2020.

Even before he became president, Trump questioned the usefulness of the alliance, calling it “obsolete.” Allies worried they could no longer count on America.

Who can forget Trump’s first NATO summit in Brussels in 2017, when he shoved aside the prime minister of Montenegro, Dusko Markovic, to clamber to the front of a photo op. Even as he wanted to stand in front, Trump continuously cast doubt on whether the US would stand by its allies.

Under Article 5 of the NATO charter, all allies are committed to each other’s defense. Trump equivocated about whether he would, preferring instead to lambast America’s friends on their inadequate defense spending, a high-profile cringe-worthy spectacle of friction that delighted dictators everywhere.

After Trump left office, President Joe Biden worked to rebuild the trust of allies. He declared America’s bond with NATO members “sacred” and rallied the alliance to support Ukraine, while maintaining that Russia would not be allowed to go “one inch” into NATO territory.

Thanks to his efforts in the face of Putin’s aggression, NATO members are boosting defense spending like never before. NATO is even in talks to open a liaison office in Japan, its first one in Asia.

And the alliance is growing – in spite of the obstacles placed in its path by Turkey’s Erdogan.

When Sweden and Finland decided to end their tradition of neutrality and join NATO to protect themselves from Russia, Erdogan found yet another way to break with his allies, accusing the Nordic countries of sympathizing with Kurdish militants. Though, in the end, he lifted a veto on allowing Finland to join. Sweden’s NATO hopes are still on hold.

In a 30-member alliance where decisions are made by consensus, Erdogan has made his country a relentless irritant, and worse. As NATO fought to integrate its weapons systems so the alliance could work better together, Erdogan seemed to sabotage the plan, buying missiles from Russia in 2019.

In neighboring Syria, he has launched attacks on US-backed Kurds fighting against ISIS. Time and time again, Erdogan complicates NATO’s plans, and draws close to the world’s dictators, NATO’s adversaries and democracy’s enemies.

Erdogan has frustrated NATO members so much, that some would like to suspend it from the alliance. But Turkey’s strategic position at the crossroads of East and West – the connecting point of the Mediterranean and the Black Sea and on the edge of the Middle East – make it too important to let go.

Its unique position – friendly with Russia yet also selling armed drones to Ukraine – has also cast Turkey as a possible mediator in the war. Last summer, Turkey helped broker the grain deal between Russian and Ukraine that got vital exports moving again.

Domestically, not unlike Trump, Erdogan has eroded democracy in Turkey. In fact, he all but invented the current model of 21st century authoritarian rule by elected leaders. Erdogan has weaved a post-truth world, inflamed his followers with divisive rhetoric, rejected election results that didn’t suit him and relied on loyal media and censorship to pitch his version of reality and maintain his devout followers in his thrall. He’s a bad fit for NATO, whose charter embraces democracy.

Get our free weekly newsletter

• Sign up for CNN Opinion’s newsletter.
• Join us on Twitter and Facebook

We won’t know for a while yet how Trump’s future plays out. Erdogan’s is another matter. The opposition is closing in. It’s unclear how he will fare in Sunday’s vote – or how he will respond if it doesn’t go his way.

Erdogan’s main challenger, opposition candidate Kemal Kilicdaroglu, has vowed that in a post-Erdogan Turkey, he would repair democratic institutions and strengthen frayed ties with NATO.

Whichever way it goes, ties with NATO will be affected. If Erdogan loses, NATO will grow stronger, more cohesive. Otherwise, Turkey will remain a reluctant member, a bad team player.

The bigger question for the alliance will come next year, with the US election. If Trump returns to power, NATO will undoubtedly weaken. In fact, it may not keep its most powerful member, reducing it to a memory of what has been the mightiest alliance in history.