President Andrzej Duda has made a surprise announcement that he will veto two of the three controversial court restructuring bills which was recently passed by the parliament.

The vetoed bills would have forced all sitting Supreme Court judges to resign and given the power to replace them directly to the government rather than the Council of the Judiciary, the body of legal experts currently tasked with selecting judges. Duda said that, while he agreed that the court should reformed, it must be a “wise reform.”

Specifically, the president objected to increasing the power of Public Prosecutor General Zbigniew Ziobro. Earlier this week, he also demanded an increase in the majority of parliamentary votes needed to confirm judges and has complained that he was not sufficiently consulted on the bills.

After this story was initially published, Duda said he would sign a third bill giving Ziobro’s office the power to select the heads of local courts and more closely guide their cases.

Nevertheless, the vetoes are unexpected, as the reforms are supported by the far-right Law and Justice PiS party which backs Duda and would increase their power over the judiciary.

This is a big victory for the thousands of people who have taken to the streets across Poland daily for over a week in protest of the bill. They argued that the reform would erode the separation of powers by giving PiS the ability to stack the Court with its own members.

The bill has also been criticized by US State Department and the European Union, where European Commission Vice President Frans Timmermans threatened to trigger the EU’s Article 7 for the first time to punish Poland with sanctions.

Anna Wajner contributed to the reporting of this article.