Poland's president on Monday vetoed controversial judicial reforms that had prompted huge street protests and threats of unprecedented EU sanctions.
President Andrzej Duda's veto was a surprise move as he is a close ally of the ruling right-wing Law and Justice (PiS) party that had pushed the reforms.
Duda said he had made his decision after consulting legal experts over the weekend, when thousands of people took to the streets across Poland urging him to veto proposals that critics say threaten the rule of law.
The reforms now return for amendment to parliament, where they require a three-fifths majority — which the PiS does not have — to go through unchanged.
"I have decided to send back to parliament — therefore, to veto — the law on the Supreme Court, as well as the law on the National Council of the Judiciary," Duda said in a televised announcement.
"This law would not strengthen the sense of justice" in society, he said.
The opposition welcomed his move.
"It's without a doubt a step in the right direction," said Kamila Gasiuk-Pihowicz, a lawmaker from the liberal Nowoczesna party.
"It's proof that pressure from citizens can work."
Polish freedom icon Lech Walesa, a Nobel Peace laureate and former president, said he "was pleasantly surprised."
"The people have woken up, young people have woken up... We'll do what we can so that these people (the conservatives) get off the wrong path or that we manage to replace them," Walesa said.
The reforms would have increased political control over the judiciary, sparking an outcry amongst critics who said the PiS party was seeking to reduce the independence of the courts.
"It was never part of our tradition that the attorney general could interfere in the work of the Supreme Court," Duda said.
The role of attorney general has been held by the justice minister in Poland since 2016, following one of the PiS's earlier reforms which sparked concern over the rule of law.
"I don't want this situation to deteriorate, because it's reinforcing divisions in society. There's only one Poland. Poland needs peace and I feel responsible for it as president," Duda said.
He added that "a good reform" of the judicial system was needed and said he hoped to table his own versions of the laws within two months.
Supreme Court chief justice Malgorzata Gersdorf offered Duda her "intellectual collaboration" on the new texts, and publicly thanked him for the veto.
The Polish senate had on Saturday backed the reforms, but they had still needed the president's sign-off.
Huge crowds of protesters held a candlelit protest outside the Supreme Court on Sunday night urging Duda to veto the changes.
Several hundred had gathered at the court again on Monday.
The European Commission had threatened to halt Poland's voting rights over the proposed reforms — a so-called "nuclear option" that the EU had never invoked — while the United States had also expressed concern.
The Commission's spokesman, Margaritis Schinas, said commissioners would discuss the situation on Wednesday.
The government has defended the reforms, calling them indispensable to combat corruption and streamline the judicial system.
The PiS, which began making changes to the judiciary after coming to power in late 2015, has argued resistance to its reforms is a case of an elite defending its privileges.
Under the current system, Supreme Court candidates are selected by an independent body consisting mainly of judges but also some politicians.
The PiS responded to Duda's shock announcement by holding an urgent reunion.
"I'm not a fan of this decision," PiS lawmaker Stanislaw Pieta told AFP.
"Once emotions have cooled down after the holidays and everyone is well-rested, we'll have to calmly prepare a new law to follow through with the great reform of Poland's judicial system that the PiS and the president himself had promised."
The president's spokesman said Duda would sign a third controversial judicial reform into law, one allowing the justice minister to replace the chief justices of all the common courts without explanation.