Poland has lost a flagship court case over its judicial meddling brought against it by the European Commission, putting its nationalist rulers on the back foot.

"Polish legislation concerning the lowering of the retirement age of judges of the Supreme Court [SC] is contrary to EU law," the EU court in Luxembourg said on Monday (24 June).

Student or retired? Then this plan is for you.

The EU gavel slammed down on Poland's decision, last April, to forcibly retire all SC male judges over the age of 65 and females ones over 60.

The measure covered one third of existing judges, including SC president Malgorzata Gersdorf, who refused to leave her office, causing a furore at the time.

The ruling Law and Justice party (PiS) said they did it in order to harmonise judges' retirement ages with those of other workers.

They also did on grounds some older judges were former communist stooges.

But the opposition and the EU commission feared the real motive was to put PiS loyalists on the SC bench.

And the EU court verdict on Monday came down on their side.

The way the retirements were handled were "such as to raise serious doubts as to the real aims of that reform", the court statement said.

The fact the Polish president, a PiS ally, was given "discretionary" powers on which older judges to keep or fire undermined the SC's independence, the EU court noted.

"That power is such as to give rise to reasonable doubts, inter alia in the minds of individuals, as to the imperviousness of the judges concerned to external factors and as to their neutrality with respect to any interests before them," the court added.

The EU commission triggered a sanctions procedure against Poland over its judicial reforms in 2017.

It filed for its EU court injunction under an "expedited procedure", last October.

The Polish government has said EU institutions had no mandate to intervene in national judiciaries.

Populist parties in the Czech Republic, Hungary, and Romania have used similar arguments, in a wider malaise on EU values in central Europe.

But Monday's EU court verdict also struck down the nationalist line of argument.

"To ensure that a body such as the Supreme Court is in a position to offer such protection, maintaining its independence is essential. Consequently, the national rules called into question by the [EU] commission in its action may be reviewed," the EU judges said.

The "existence of mutual trust between the member states" in judicial affairs depended on judicial independence, they added, after some EU countries had held up extraditions to Poland due to its judicial controversies.

"This is an important ruling in support of the independence of the judiciary in Poland and beyond," the EU commission said on the court's decision.

"The judgement also clarifies that, although the organisation of justice in the member states falls within national competence, when exercising that competence the member states are required to comply with their obligations under EU law," it added.