Five senior Polish generals resigned this month in a major and abrupt shakeup along NATO’s eastern flank. That is nearly a quarter of Poland’s general...

Five senior Polish generals resigned this month in a major and abrupt shakeup along NATO’s eastern flank. That is nearly a quarter of Poland’s general staff, according to the Gazeta newspaper. It may be the biggest shakeup of the country’s senior military leadership since the end of the Cold War.

The generals didn’t give a public reason for their exit. But it’s highly unusual for senior staff to resign en masse, let alone before the upcoming 2016 NATO summit to be held in Warsaw. “The generals in question included joint staff chief Ireneusz Bartniak and the commanders of land forces, the navy and the armored and airborne forces,” the AFP reported.

However, Polish media have reported the resignations were because of growing exasperation with defense minister Antoni Macierewicz, who has a hard-line reputation for rooting out ex-communists — regardless of how implausible the allegations.

According to Gazeta, the tipping point was a recent speech from Macierewicz where he said officers who joined the military during the communist era do not have a future in the armed forces. The generals also feared their pensions were at risk of being cut.

But among the problems with ridding Poland of communism, is the fact that there is very little communism to get rid of. Poland threw out its socialist rulers 27 years ago, and a communist resurgence today is about as likely as another German invasion.

In fact, the trend is in the opposite direction. Poland has banned communist symbols. The political spectrum in parliament ranges from the center to the far right. The only moderately left-wing Polish political party with any influence at all has no representation in parliament.

Nor is the exodus of Polish generals an isolated event. Rather, Macierewicz — who took over the defense ministry in November 2015 — is emblematic of an increasingly right-wing and nationalist shift in Polish politics under the ruling Law and Justice party, which swept into power last year.

The new government has sought to consolidate authority with purges. It has replaced civil service bureaucrats and security officials with party loyalists. And this tactic has extended to the military.

“Macierewicz had established a reputation as Poland’s Ted Cruz — a firebrand willing to take down his political opponents even at the cost of his own position,” John Feffer, a journalist who interviewed him in 1990, wrote for the website Foreign Policy in Focus.

Above — Antoni Macierewicz. Drabikpany/Flickr photo. At top — Macierewicz with Col. Andrzej Dabrowski during a military exercise in January 2016. U.S. Army photo

Macierewicz was not always a right-wing nationalist. In the 1980s, he participated in the broadly social democratic, anti-communist Solidarity movement. But following the collapse of communism, he embraced a mix of Polish nationalism and Catholic-oriented social conservatism.

In 1992, he served a stint as interior minister and lasted six months. In McCarthyite fashion, he presented the “Macierewicz List,” which falsely labeled dozens of government officials as ex-communist agents. The backlash to the list brought down the government in a vote of no confidence.

During the next two-and-a-half decades, Macierewicz served as a parliamentarian, briefly as Secretary of State of the Defense Ministry and chief of the Military Counterintelligence Service, or MCS. Now with Law and Justice in power — and Macierewicz as defense minister — he’s plunged the agency into a “time of chaos,” according to Gazeta.

In the middle of the night on Dec. 18, military police and Defense Ministry officials raided a NATO counter-intelligence facility in Warsaw. That ended with the sacking of Col. Krzysztof Dusza, the center’s chief who was appointed under the previous government. Opposition parliamentarian Tomasz Siemoniak, an ex-defense minister, called the raid “probably the first time in NATO’s history that an alliance member has attacked a NATO facility.”

“Macierewicz has undertaken a purge of the military as if it were populated by communist-era appointees rather than officials designated by the previous center-right government,” Feffer wrote. “This is how coup leaders, not democratically elected governments, go about the business of cleaning house.”

Macierewicz is also a conspiracy theorist. He believes Russia brought down the Polish air force passenger jet which crashed outside Smolensk in 2010, killing dozens of government officials including Pres. Lech Kaczynski. The Polish and Russian governments have both concluded that heavy fog and pilot error contributed to the crash.

Nevertheless, Macierewicz has pressed ahead with another investigation.

A Polish W125 anti-aircraft missile launcher during a joint Polish-U.S. exercise in January 2016. U.S. Army photo

All of this puts NATO in an awkward position. Poland is strategically vital to the alliance’s eastern border with Belarus — Russia’s closest ally — and the Kremlin’s heavily-militarized enclave in Kaliningrad.

Since the Russian invasions of Crimea and eastern Ukraine, U.S. Pres. Barack Obama has shored up America’s alliance with Poland. The Pentagon’s budget request for 2017 will establish an “essentially permanent” American troop presence in the country. The Polish military is still reliant on Soviet-era legacy weapons and is hungry to replace them with Western hardware — the more advanced, the better.

Arms manufacturers in the United States and the European Union are eager bidders.

Yet Law and Justice is unlike most of NATO’s governing parties. It has an illiberal, paranoid and xenophobic streak. It has attempted to remove the top court’s power to rule legislation as unconstitutional, a check on the party’s power.

It shares an ideologically affinity with Hungary’s ruling party Fidesz, which has clamped down on civil liberties and consolidated power around Prime Minister Viktor Orban. (Law and Justice leader Jaroslaw Kaczynski, Lech’s twin brother, is an admirer.)

The main difference being that Fidesz is very much pro-Kremlin, while Law and Justice is very much not. But there’s the predicament.

Defending the security of the Western liberal order is fundamental to NATO’s mission. And analysts have long pointed to Russian Pres. Vladimir Putin — and Orban — as representing new ideological rivals. These leaders are politically distinct, and rose to power with the support from constituencies left behind by globalization and let down by left-wing, centrist and traditional conservative parties.

Law and Justice emerged from a similar vacuum, with its base of support in Poland’s poorer and less-developed east. Two decades of rapid economic change screwed over a lot of people, and the nationalist right was the only faction left standing in the wreckage.

Which means the phenomenon is not limited to Russia and its allies — it’s spreading within NATO, too. And the alliance is losing generals on its eastern flank because of it.