As rifts appear in the ruling camp, the turmoil in Poland is far from over.

Poland has just seen a serious week-long crisis over three controversial draft laws on the reform of the judiciary. The laws were passed through the parliament at blistering speed in an effort to give the ruling Law and Justice party (PiS) control over the Supreme Court, the National Council of the Judiciary, and the lower courts. In sum, they represented a clear assault on the separation of powers and the rule of law.

On Monday, however, with hundreds of thousands of people demonstrating in the street, President Andrzej Duda vetoed two of the three bills. Despite the large protests, his vetoes came as a shock to most observers. Duda comes from the ruling party (PIS) and has been widely seen as a puppet of Jaroslaw Kaczynski, the powerful leader of the PIS. Kaczynski had stated unequivocally that PIS would deliver on its promise of judicial reform, full stop. The Minister of Justice, Zbigniew Ziobro, bluntly told the protesters that they could forget their dreams of a Presidential veto. It all looked like a done deal.

So why did President Duda veto these laws? Did Mr Kaczynski change his mind? Or did the alleged Presidential puppet finally stand up to the puppeteer? And what does this incident tell us about the future of liberal democracy in troubled Poland?

In Duda’s statement accompanying his veto, he argued that the proposed bills would undermine judicial independence, that they were introduced in the parliament without consulting him, and that they would fail to increase the population’s sense of security. He also noted the tensions they had generated and did not want these tensions to deepen.

And tensions have been extremely high. Mass protests have revealed people's increasing fury about the government's actions. PIS members dismissed the protesters as communists, former agents of the communist security services, traitors or people just having a nice summer walk. They also sneered at the idea that people could have read the 140-page-long Supreme Court bill in its entirety to know what they protested about. Meanwhile in the parliament Mr Kaczynski yelled that the opposition are scoundrels who 'destroyed and murdered' his twin brother. Then-President Lech Kaczynski died in a tragic plane crash in Russia in April 2010, and investigations have concluded that the crash was an accident.

But despite the government’s angry dismissals, the protests have surprised the PiS and the opposition alike in their perseverance, size and composition. They have spanned generations and have seen the participation of an unprecedented number of young people, until now generally considered fairly indifferent to the erosion of democracy in Poland. The President must have realised that hundreds of thousands of protesters are not a negligible or treacherous minority, but a real force, with legitimate concerns about the future of Polish democracy.

Thus Duda faced a choice: either continue to support the government on a collision course with the electorate, or alienate the very leaders that helped put him in power. But he knows that he needs over 50% of the vote to be re-elected and thus has to remain in the centre. Support for PiS has never broken a ceiling of about 40% and currently hovers around 38%. This level of support is enough for the PiS to remain in government, but perhaps not for Duda to remain president. Mass protests have changed the president’s political calculus, which now diverges from Kaczynski’s.

Reactions from PIS show that it is as shocked by the veto as everyone else. Prime Minister Beata Szydło announced that the government will not bow to pressure – neither from the street nor from abroad. She regretted that the veto has slowed down reform. PIS is open to discussing the details of reform, but the courts must be controlled and on that principle it will not budge. However, she did not explain how the PIS now plans to achieve judicial reform based on that principle.

The chances are that it will try to override the presidential veto, but for that it would need to get a three-fifths majority in parliament, and it would mean PiS going to war with its own President. As rifts appear in the ruling camp, the turmoil in Poland is far from over.

Read more on: Wider Europe, European Power, Cohesion & Governance, National Politics, Anti-Establishment Parties