July 24 (UPI) — Polish President Andrzej Duda on Monday vetoed two proposed laws that would have allowed the ruling Law and Justice right-wing political party control over the judiciary — a subject of widespread protests.

Tens of thousands of Polish citizens protested in recent weeks against the proposed judiciary reforms, and called on Duda to veto the measures.

During a televised press conference Monday, Duda said he did veto the proposals because he feels “reform in this shape will not increase the sense of security and justice.” He added that changes to the judiciary are needed.

“Poland needs reform of the judiciary,” Duda said. “But I am a supporter of a wise reform.”

However, the Polish leader said he would sign another bill granting Poland’s minister of justice the power to select the leaders of each of the country’s regional courts.

The judiciary reform effort by the Law and Justice party, or PiS, would have forced all Polish Supreme Court justices to step down. The law, which passed Poland’s Senate last week, comes after the PiS passed an earlier bill giving parliament more power in the appointment of judges.

Critics of the reforms argue the laws will erode the independence of judges and undermine Poland’s democracy. The PiS argues the changes are necessary because the judiciary system is corrupt and benefits the Polish elite. The PiS also says the judiciary was not purged after the fall of communism, suggesting the ideology affects the branch.

The European Union warned Poland it was considering triggering the Article 7 sanction, which would suspend Poland’s EU voting rights, if the laws were enacted.

The U.S. Department of State also criticized the Polish proposals.

“The Polish government has continued to pursue legislation that appears to undermine judicial independence and weaken the rule of law in Poland,” the State Department said in a statement. “We urge all sides to ensure that any judicial reform does not violate Poland’s constitution or international legal obligations and respects the principles of judicial independence and separation of powers.”