Kacper Pempel / Reuters

Poland’s president has unexpectedly vetoed a controversial measure that critics say would have eroded the judiciary’s independence, staving off punitive action from the European Union but possibly setting up a fight with the country’s ruling party.

“As president I don’t feel this law would strengthen a sense of justice,” President Andrzej Duda said. “These laws must be amended.”

He said he spent the weekend speaking to experts in the field, including former Soviet-era dissidents who persuaded him to take the step that is likely to set him on a collision course with the ruling Law and Justice Party (PiS).

At issue are two measures—one that mandates that all Supreme Court judges resign and be replaced by the government’s picks, and the other that gives lawmakers say over the composition of the National Judiciary Council (KRS), the body that appoints judges. Duda vetoed both of these bills, but he signed into law a third controversial measure, which gives the justice minister the right to appoint judges on lower courts.

Poland’s parliament, where the ruling Law and Justice Party (PiS) has a comfortable majority, passed the measures last week despite protests that were described as the largest in recent years. Duda, who normally supports PiS, said at the time he saw flaws in the bills, which had become a flashpoint in Poland’s relationship with the EU. As I wrote Saturday:

The EU threatened Poland with the unprecedented step of sanctioning it with Article 7 of the Treaty on European Union, a move that would suspend Warsaw’s voting rights within the bloc. But the threat by the EU’s first vice president, Frans Timmermans, notwithstanding, any move to use Article 7 must be unanimous—and that’s not likely given that Hungary, Poland’s Visegrad ally, has threatened to veto any such action.

The bloc also threatened to begin infringement procedures against Poland as early as this week. It’s unclear if Duda’s veto will put that action—or criticism from the EU—on hold. The EU was especially concerned about the legislation because the separation of powers between the executive and judiciary is enshrined as one of the bloc’s fundamental principles. Donald Tusk, a former Polish prime minister who is now the president of the European Council (and no friend of the PiS), had said the measures would “ultimately lead to the marginalization of Poland in Europe.” He had sought a meeting with Duda, who had rebuffed the request.

The EU and Polish critics of the measures notwithstanding, the PiS and its supporters say the changes were needed to overhaul the country’s judiciary. They say the court’s judges are elitists and the changes are needed to make the court more accountable. Indeed, Poles have in the past supported a judicial overhaul, citing the slow pace of the system and sometimes controversial rulings, but even political parties that support a judicial overhaul in principle say the government’s effort went too far. By stacking the court with it allies, they argues, PiS would destroy the independence of Poland’s judiciary.

Critics of the government say the move to overhaul the judiciary is in keeping with the PiS’s other recent actions, including its tightened grip on the state media and NGOs. PiS, which is a right-wing party, enjoys a relatively high approval rating over its rivals in parliament.

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.