Want smart analysis of the most important news in your inbox every weekday along with other global reads, interesting ideas and opinions to know? Sign up for the Today's WorldView newsletter.

Update: On Monday morning, Polish President Andrzej Duda surprised virtually everyone by announcing he would veto the proposed legislation, a move likely in reaction to widespread mass protests against the ruling party's efforts to overhaul the judiciary.

The right-wing government in Poland is on a collision course with the European Union.

Over the weekend, a bill overhauling the country’s judiciary passed both chambers of the parliament. If it gets adopted, the ruling Law and Justice Party will be able to fill Poland's Supreme Court with its hand-picked allies. Critics warn it would be a profound step toward authoritarianism.

The measure has led to the biggest street protests since the populist conservative party came to power in 2015. Lech Walesa, the 73-year-old former president, joined demonstrators in the city of Gdansk, where he led landmark strikes in the 1980s that helped topple communism. He warned that the freedoms won by the anti-communist struggle are now under risk.

“Our generation managed, in the most improbable situation, to lead Poland to freedom,” he said to the crowd in the city's Solidarity Square. “You cannot let anyone interrupt this victory, especially you young people … You must use all means to take back what we achieved for you.”

Lech Walesa speaks near the Monument of Fallen Shipyard Workers in Gdansk, Poland, on July 22. (Adam Warzawa/European Pressphoto Agency)

Donald Tusk, the president of the European Council and a former Polish prime minister, described the legislation as “a negation of European values and standards” that would “move us back in time and space — backward and to the East.” The “East” was less a geographic signifier than a marker for a different, darker era of Polish politics, when Warsaw was subject to the whims of Moscow and isolated from Europe's liberal democracies.

A statement from the U.S. State Department urged the government to reconsider the bill, which it declared would “undermine judicial independence and weaken the rule of law in Poland.” Yet the White House seems to have sent a different message.

After all, it was in Warsaw earlier this month that President Trump championed his vision of the West to a crowd of supporters bused in by the ruling party. Trump said nothing then about the importance of rule of law or the preservation of democratic institutions. Instead, he delivered a paean to blood-and-soil nationalism, anchored in antipathy to Islam and airy appeals to Christian values and the sacrifices of “patriots.”

Michal Kobosko, the director of the Atlantic Council’s Warsaw Global Forum, told The Post that Trump's rhetoric clearly “encouraged to move forward with their offensive against the courts.”

“In giving such a speech in such a place, Trump has confirmed Poland’s nationalist government in its isolationist and anti-democratic course,” wrote Post columnist Anne Applebaum.

Polish President Andrzej Duda vetoed two out of three bills aimed at reforming Poland's judiciary July 24, after five days of protests, with tens of thousands of people on the streets. (Reuters)

That course has been charted by Jaroslaw Kaczynski, the Law and Justice Party's co-founder and boss and the de facto leader of Poland. Both the country's prime minister and president are seen as loyal accomplices to Kaczynski's agenda. Protesters were staking their hopes on the latter — President Andrzej Duda — to veto the widely unpopular legislation, but he is expected to sign it into law after a few amendments.

Its implications are staggering. “Here’s the crowning blow in ending judiciary independence in Poland,” wrote Monika Nalepa of the University of Chicago. “Since the Minister of Justice already simultaneously holds the position of Prosecutor General, the ruling majority may now choose both the prosecutor AND the judge in every single court case.”

People participate in a protest in front of the Senate building in Warsaw, July 20. (Bartlomiej Zborowski/European Pressphoto Agency)

For Kaczynski and his allies, though, the takeover is part of their project to “renationalize” Poland. Kaczynski sees the judiciary as infested with crypto-communists and liberals “subordinated to foreign forces.” He peddles various conspiracy theories, including his belief that Tusk and his liberal colleagues hatched a plot that led to a 2010 plane crash in which Kaczynski's twin brother died.

When the incident came up during a parliamentary debate about the judicial reforms last week, Kaczynski exploded. “Don't wipe your treacherous mugs with the name of my late brother,” he said to his liberal adversaries. “You destroyed him, you murdered him!” This sort of polarizing rhetoric has become the stock-in-trade of politicians in nearby Hungary or Turkey, where illiberal conservatives have also set about subverting and transforming democracies in their image.

Kaczynski's populist platform — built on Catholic piety, anti-cosmopolitan nationalism and generous cash handouts — won his party the support of close to 40 percent of Polish voters, and he may seek to consolidate that position through elections later this year. The liberal opposition, meanwhile, is floundering, as Der Spiegel observed.

“The bedrock of [the liberal] political platform has always been the E.U.," noted the German magazine. “Its vision is basically that so long as Poland is a reliable European partner, aid from Brussels will ensure prosperity for all. The trouble is that few people believe in this vision in the remote east of the country, in villages and small towns.”

The protests against the new judicial reforms may present a galvanizing moment for the opposition. Last year, the government was forced to back down from an abortion ban after mass protests hit the streets.

“We will show that we refuse to live without freedom,” said Radomir Szumelda, a 45-year-old liberal activist, to my colleague Isaac Stanley-Becker. “Young people who didn’t live under communism may not know what that was like, but they are also joining us, and together we are saying that we can’t go back.”

But they may not get much assistance from the European Union. Despite the scolding statements coming from various corners, real punitive measures can only be slapped on Warsaw by a unanimous vote within the bloc. Hungary's illiberal prime minister, Viktor Orban, has already made clear that he would veto such censure.

And, looking further west, it's unlikely the American president — another politician at war with liberalism and convinced of judicial plots against his rule — will lift a finger to prevent Warsaw's slide away from Europe.

Want smart analysis of the most important news in your inbox every weekday along with other global reads, interesting ideas and opinions to know? Sign up for the Today's WorldView newsletter.