WARSAW, Poland — Anti-government protesters rallied in front of Poland's Supreme Court in Warsaw on Wednesday to show support for the court's president, who is being forced to retire under a judicial overhaul.

The hundreds of people who gathered sang the national anthem and chanted "Judges are not removable!" and "Constitution!" as the court's First President Malgorzata Gersdorf showed up for work, saying that according to the constitution, her six-year term runs through 2020.

Gersdorf, 65, thanked the crowd and said she was acting to protect Poland's constitution. It was not immediately clear whether she would be allowed back into her office on the first day of her forced retirement.

Protests started this week against the new law, mandated by the right-wing ruling party, that cuts the retirement age to 65 from 70 for Poland's Supreme Court justices.

Under the new rules, Gersdorf should have asked President Andrzej Duda for an extension of her mandate if she was to be of retirement age on July 4. She has not done so.

"That would mean subordination," Gersdorf said. "And I cannot agree to this because I need to fulfill what I swore I would."

Protesters gather in front of Poland's Supreme Court building in Warsaw on Wednesday. Czarek Sokolowski / AP

The law, which took effect Tuesday, is forcing the chief justice and as many as one-third of the court's 72 sitting judges to step down. It is seen as the ruling Law and Justice party's clampdown on the top court.

The Supreme Court shake-up represents the culmination of a comprehensive overhaul of Poland's justice system that gives the ruling party new powers over the courts.

Critics at home and abroad accuse the Law and Justice party of seeking control over courts for political gain, and say its policies, which also include tighter control of public media, amount to a shift towards authoritarian rule.

European Union officials and international human rights groups have expressed alarm, alleging the moves represent an erosion of judicial independence that violates Western standards. The European Commission, which polices compliance with E.U. laws, opened an infringement procedure Monday against Poland over the Supreme Court law.

The Supreme Court is the highest court of appeal for criminal and civil cases in Poland. Its justices also rule on the validity of elections.

The government insists it is improving Poland's justice system, saying it was inefficient and controlled by an untouchable "caste" of judges. It argues that putting judges under the control of the legislative and executive branches will makes the courts answerable to the voters, and thus more democratic.

The ruling Law and Justice party's standing in polls has held steady at around 40 percent throughout the dispute, well above any single rival party.

It rejects criticism, saying E.U. treaties do not give Brussels institutions the power to influence national matters such as the judiciary.