(CNN) Polish President Andrzej Duda on Thursday signed into law a controversial judicial reform measure that will make it easier for the nation's ruling party to appoint a new head of the Supreme Court.

The Senate approved the legislation earlier this week, despite opposition from civic rights protesters and the European Union.

Judges applying for posts at the Supreme Court should do so by July 29, Duda said in announcing the signing in a statement on the presidential website.

Poland's governing party -- the Law and Justice Party (PiS) -- earlier this summer pushed through another law requiring Supreme Court judges over the age of 65 to retire, which had the effect of forcing out Chief Justice Malgorzata Gersdorf and more than two dozen other judges.

Gersdorf has refused to step down.

The law signed Thursday allows her successor to be chosen when only two-thirds of the positions on the court are filled, instead of nearly all of them.

The European Commission has launched legal action against Poland over the changes, accusing it of eroding judicial independence. The matter could end up before the European Court of Justice, the bloc's highest court.

The government is keen to push through its latest reforms quickly so that it can appoint a new chief justice without having to have so many new judges in place -- and before the European Union can intervene.

Critics say that the Polish government is eroding the rule of law and that its so-called reforms are intended to give it control of the judiciary. But Prime Minister Mateusz Morawiecki insisted that the measures are needed because the justice system has not been sufficiently overhauled since the collapse of communism in 1989.

There are 72 justices on Poland's Supreme Court.