A furious Jarosław Kaczyński lashed out at the opposition in parliament | Bartomiej Zborowski/EPA Polish president bucks ruling party over judicial reforms During a bad-tempered debate, Jarosław Kaczyński accuses the opposition of ‘murdering’ his brother.

In a rare display of political defiance, Polish President Andrzej Duda on Tuesday bucked his political patron Jarosław Kaczyński by moving to slow an effort to bring the judiciary under government control.

The ruling Law and Justice party (PiS) has been pushing through legislation that dramatically changes Poland’s legal order — raising concerns from the EU and human rights organizations, and sparking anti-government demonstrations over the weekend.

Last week, parliament adopted a new law revamping the body that appoints judges, the National Council of the Judiciary (KRS), ending the terms of its 15 judges and allowing parliament, where PiS has a narrow majority, to nominate their successors.

The ruling party then moved on to legislation that would immediately retire all the judges on the Supreme Court except those designated by Justice Minister Zbigniew Ziobro, and would lower the requirements for future judges chosen for the court — a step critics say would allow the ruling party to pack the court with its allies. The Supreme Court is Poland’s top court for civil, criminal and military cases; it also confirms election results.

PiS says the court system is slow, corrupt and inefficient.

All of the legislation has to be approved by Duda, a former Law and Justice MEP chosen by Kaczyński to run for president in 2015. He has been leery of vetoing legislation backed by PiS, and has strongly identified with the party’s program despite the Polish tradition of presidents being non-partisan.

Duda stepped into the polarized debate over the judicial reforms on Tuesday, saying he had submitted his own legislation regulating the KRS. Under his version, new judges would have to be chosen by a three-fifths majority in parliament — and Law and Justice falls short of that on its own.

If parliament does not pass his bill, Duda said he would veto legislation on the Supreme Court.

“This project is aimed at preventing the assertion that the KRS is controlled by only one grouping, that it acts under political dictate,” Duda said.

However, Duda made clear he supports PiS’ broader aim of reforming the judiciary. “I agree that reform of the KRS is needed, and with the essential direction of that reform. I’m also convinced that the [Supreme Court] needs reform.”

Beata Mazurek, a PiS spokeswoman, said parliament won’t consider Duda’s bill unless he first signs last week's legislation on the KRS into law.

Duda’s intervention came during a stormy debate in parliament over the Supreme Court reform bill. Police surrounded the building as protesters gathered outside. The debate resumed Wednesday morning.

Late Tuesday, a furious Kaczyński lashed out at the opposition after MPs said that his dead twin brother, former President Lech Kaczyński, would have opposed the new judicial laws. Kaczyński stormed to the podium of the parliament and accused the opposition of being responsible for the 2010 airplane crash that killed his brother.

"Do not wipe your treacherous mugs with the name of my late brother. You were destroying him, you murdered him, you are scum," he shouted.

Grzegorz Schetyna, leader of Civic Platform, the largest opposition party, greeted Duda's unexpected intervention with "relief."

"This is a good move in a good direction," he told reporters.

The opposition accuses Law and Justice and Kaczyński, Poland’s most powerful politician, of subverting the constitution by eroding the independence of the judiciary.

Małgorzata Gersdorf, the chief justice of the Supreme Court, addressed parliament earlier Tuesday, saying there was no reason to eliminate the court.

“At the moment the bill says that the minister of justice, in other words a part of the executive branch, controls everything,” she said. “There is no basis for this in the constitution.”

PiS says the court system is slow, corrupt and inefficient. Kaczyński has called judicial reform “absolutely fundamental.” His accusation is that 27 years after the end of communism, the courts are still under the control of communists and their heirs. The average age of a Polish judge is 38.

“The courts have essentially stayed the same as in communist Poland,” he told a rally of the ruling party earlier this month.

Kaczyński has long been a foe of the court system, which blocked some of his initiatives during Law and Justice’s previous government, which ruled from 2005-2007.

Kaczyński’s view is that the parliamentary majority his party won in 2015 gives it the right to rule the country, without other institutions like the courts blocking the government. In a recent interview, he said he wants to “return the courts to the nation and return the functioning of a democratic electoral system over the courts.”

The effort to bring the judicial system under political control has sparked strong opposition in Poland. On Sunday thousands of people rallied outside the Supreme Court, surrounding its headquarters with candles.

However, the opposition parties are fragmented and have been unable to find a leader who appeals to the country at large. Opinion polls show that PiS still has the support of about a third of the electorate, far ahead of the opposition.

If Duda’s initiative passes, it would make it more difficult but not impossible for the ruling party to control the KRS. PiS has 234 seats in the 460-seat parliament, so falls short of the 276 votes needed if Duda’s bill is approved. However, if one populist party and independent MPs support PiS, it could marshal 277 votes.

The Polish government’s efforts are alarming Brussels. Earlier efforts to defend the Constitutional Tribunal, a court that rules on whether legislation is constitutional, failed and PiS now controls that body. The Supreme Court was due to consider in September whether the restructuring of the tribunal was legal.

The Commission is due to discuss the situation in Poland on Wednesday.

Michał Broniatowski in Warsaw contributed to this article.

This article has been updated with Jarosław Kaczyński's speech in parliament.