Speaking days before an election most observers thought him sure to win, a long-serving Eurasian strongman railed against human rights, malevolent western powers, and rapacious “international speculators.” If delivered a fourth term in office, he vowed, vengeance against enemies of the state would be swift. His ruling party would achieve “satisfaction” against its adversaries, both foreign and domestic, he pledged in language that sounded both threatening and heartfelt.

This could easily have been Vladimir Putin, but it wasn’t. It was the leader of an American treaty ally. Under Prime Minister Viktor Orbán, who faces an election this weekend, Hungary has become an increasingly autocratic and pro-Russian state—and it’s one that also happens to be in NATO.

In addition to the threat of Russian adventurism, NATO is facing a new menace, and the enemy is within. The alliance of 29 states bound by a pledge of collective defense has, particularly since the conclusion of the Cold War, defined itself by a set of common values and a membership composed of human rights-respecting democracies. The accuracy of this self-conception preceding the fall of the Berlin Wall was at times debatable. Today, it may be falling apart.

From Budapest to Warsaw to Ankara, a new generation of strongmen within the alliance seeks to govern in a manner closer to that of Putin than to that of the democratic reformers of the immediate post-Cold War epoch. Which raises the question of whether an alliance, designed to contain the Soviet Union and ostensibly organized around democratic ideals, can endure attacks on the rule of law by a growing subset of its members.

“Russia aims to weaken U.S. influence in the world and divide us from our allies and partners,” says the Trump administration’s 2017 National Security Strategy. The line, while accurate, reflects poorly on the strategy’s ostensible author, given that among other things it implicitly refers to Russian meddling in the 2016 presidential election on behalf of Donald Trump. Left unwritten is that Russia’s goal of creating distance between the United States and its allies is part of what attracted it to Trump in the first place. As a candidate, Trump called NATO “obsolete.” As president, he initially declined to reaffirm America’s commitment to the alliance’s mutual defense provision, before begrudgingly reversing course at the insistence of his advisers.

Russian interference in elections on both sides of the Atlantic, and particularly its recent alleged poisoning of a former spy in the United Kingdom, may have had the unintended consequence of drawing many NATO allies closer. Yet divisions emerging from democratic backsliding by NATO states may have the effect, over the longer run, of contributing to Russian aims.

Start with Hungary, once considered a post-Cold War democratic success story. Since coming to power in 2010, the government led by Viktor Orbán has enacted far-reaching changes to the country’s constitution, election laws, and courts. The effect has been to politicize virtually all elements of national government to advantage Orbán’s Fidesz party, and to facilitate blatant crony capitalism.

Orbán, who lacks a strong political opponent to run against this weekend, has instead focused a stream of invective against migrants, Muslims, the European Union, and George Soros, while repeatedly flirting with anti-Semitism. These messages are delivered via a once-independent media that has largely been captured by the prime minister’s allies. Civil-liberties groups in the country, under legal attack for years, are bracing for increased hardship if not outright elimination by a leader who has publicly praised Putin’s illiberal state.

Not content to simply emulate the Russian model domestically, Orbán has also adopted an increasingly pro-Russian foreign policy, and, in the words of a recent Senate Foreign Relations Committee minority staff report, “has taken no discernable steps to stop or even discourage Russian malign influence.” Orbán has been explicit in his criticism of Western sanctions against Russia for its invasion of Ukraine. Multiple reports, meanwhile, indicate that Russian intelligence services may be using Hungary as, in the words of a former U.S. embassy official, “an intel[ligence] forward operating base in NATO and the EU.”

If the policies of the Hungarian government call into question that country’s commitment to the stated values and interests that underpin the NATO alliance, its Polish counterpart presents a more complicated picture.

Since coming to power in 2015, Poland’s conservative Law and Justice party has maintained the country’s longstanding antagonism toward Russia, and welcomed NATO forces (including those of the United States) into the country. Bound by a common platform of nationalism, euroskepticism, and anti-migrant sentiment, Warsaw has also emulated and protected Hungary’s illiberal turn within the EU. The party led by Jarosław Kaczyński, a former prime minister, has followed Orbán’s Hungarian model at an accelerated pace—undermining independent courts, curtailing the ability of non-governmental organizations to operate freely, and impairing the country’s media.

Most recently, in February, the Polish government absorbed international opprobrium, including from the State Department, for enacting legislation that criminalizes speech related to the involvement of the Polish government or people in the Holocaust. The EU, criticized for failing to stop Hungary’s illiberal slide, has responded to these actions by invoking the EU Treaty’s Article 7 procedure, or so-called “nuclear option,” which would ultimately strip Poland of its voting rights within the bloc.

The chances of such an outcome, however, are slim. Orbán and Kaczyński have made clear that they will ride to each other’s rescue, creating an emerging “axis of illiberalism” within Europe. The NATO alliance thus faces a problematic odd couple. On one hand is a leader whose government openly seeks closer ties with the Kremlin. On the other is a Russia hawk whose government hosts one of four multinational “battlegroups” on NATO’s eastern periphery, yet may be strengthening Russia’s hand in the long run by hollowing out his country’s institutions and backing his southern neighbor.

For all of these troubling aspects, the parallel assaults on rule of law in Hungary and Poland pale in comparison to those in Turkey. Since an attempted coup in July 2016, President Recep Tayyip Erdoğan’s government has maintained a state of emergency under which an estimated 60,000 people have been arrested, with many tens of thousands more losing their jobs. Earlier this year, Freedom House downgraded the country from “partly free” to “not free” in its annual survey. According to human rights groups, Erdoğan’s government is engaged in disappearances and torture, and has begun prosecuting its citizens for critical posts on social media.

Turkey’s slide into authoritarianism has coincided with a worsening diplomatic relationship with the United States. On March 13, Turkish prosecutors indicted American pastor Andrew Brunson on charges related to the failed coup, seeking life imprisonment. Brunson has been held in pre-trial detention for 18 months in what some analysts describe as a hostage-taking related to Turkish requests for the United States to extradite cleric Fethullah Gulen, whom Ankara blames for the failed coup. The Brunson indictment follows the conviction in February of dual Turkish-American citizen and NASA employee Serkan Golge, who was sentenced to 7 and a half years in prison in a trial the U.S. embassy in Ankara alleged lacked credible evidence.

In addition to tensions over the coup attempt and its aftermath, Washington and Ankara have long differed on fundamental aspects of policy concerning the conflict in Syria. Today, the two allies stand perilously close to confrontation over the Kurdish-controlled Syrian town of Manbij. And, like Orbán, Erdoğan has sought closer ties with Russia, with Turkey recently announcing that it would buy the Russian S-400 long-range air and anti-missile defense system instead of a NATO interoperable system.

Throughout the Cold War, NATO alliance members did at times fail to live up to the democratic principles enshrined in the North Atlantic Treaty. Portugal joined NATO as a founding member while under the corporatist dictatorship of António Salazar. Turkey, which joined in 1952, suffered three breakdowns of democratic governance and subsequent military rule during the Cold War. Likewise, Greece remained a NATO member in good standing following a 1967 coup d'état and seven ensuing years of military dictatorship marked by grievous human rights violations.

Yet the mounting authoritarianism in Hungary, Poland, and Turkey likely poses the greatest internal threat to the NATO alliance in its history. Any alliance depends on its members sharing common goals. During the Cold War, NATO served to keep peace in post-WWII Europe by “keep[ing] the Soviet Union out, the Americans in, and the Germans down,” in the famous telling of its first secretary general. With the raison d'etre of territorial defense essentially nullified by the collapse of the Soviet Union, NATO has until recently largely justified itself through so-called “out-of-area” operations in places like Bosnia and Afghanistan, and by the presumed power of the alliance to bind its members around respect for democratic values and institutions. In 2016, the leaders of NATO member states went so far as to say that its “essential mission” was “to ensure that the Alliance remains an unparalleled community of freedom, peace, security, and shared values, including individual liberty, human rights, democracy, and the rule of law.”

As tensions rapidly escalate with Russia, territorial defense, particularly of those former Soviet states now anchoring the alliance’s eastern edge, has come roaring back. But it would be a mistake to prioritize short-term expediency over long-term cohesion. Ultimately, alliances rely on trust, and shared values are one of the core reasons that treaty members can trust one another. Illiberal turns can have direct consequences for intelligence-sharing and defense cooperation. Turkey’s pending acquisition of the S-400 air defense system is case in point.

And while the North Atlantic Treaty contains no provision to suspend members deemed to be operating in contravention of its principles, member states can challenge offending governments. Congress and the administration are already taking halting steps in this direction. The State Department recently advertised a grant that would help bolster Hungary’s beleaguered independent media sector, and has in the past has barred the travel to the United States of Hungarian officials over corruption allegations. The administration and members of Congress have criticized the Polish government for its steps to erode judicial independence and chill free speech. In October, the U.S. embassy in Ankara took the unprecedented step of ceasing to process visas in response to Turkey’s detention of Turkish citizens employed at U.S. consulates.

Even stronger measures—more funding for civil-liberties groups, say, or even targeted sanctions—are unlikely to reverse illiberal trends in Turkey, Poland, and Hungary in the near term, particularly when the president of the United States evinces authoritarian tendencies of his own. Still, such steps can send a strong signal to audiences within these countries, and to populist leaders elsewhere in Europe, that the United States (minus the commander-in-chief, perhaps) considers backsliding on democracy within the world’s premier democratic alliance a matter of national security. A NATO alliance grounded in respect for human rights cannot, over the long term, abide chronic abusers of human rights. Nor can it effectively counter the likes of Vladimir Putin with Putinesque leaders in its midst.