(CNN) The European Union's highest court ordered Poland to "immediately suspend" the application of a controversial law, which lowered the retirement age of its Supreme Court judges, in a ruling Friday.
The "Law on the Supreme Court," which came into force on April 3, mandated that all Supreme Court judges over the age of 65 retire, pushing 27 of the 72 judges off the bench.
The government, led by Prime Minister Mateusz Morawiecki, insisted that the measures were needed and were put in place to strengthen democracy.
But critics of the law say the move eroded the rule of law, and that its so-called reforms were intended to give Morawiecki's right-wing Law and Justice party (PiS) control of the judiciary.
The measure was met by protests across the country and further escalated tensions between the European Union and Poland's government.
In July, the European Commission, which is the politically independent executive branch of the EU, issued a Letter of Formal Notice to Poland, setting out its concerns about judicial independence. It argued that the law is "incompatible with EU law as it undermines the principle of judicial independence," and said that its implementation could lead to "serious and irreparable damage" to the European Union's legal order.
In August, Poland replied to the letter, rejecting the Commission's concerns.
More letters were sent between Poland and the Commission, but they failed to alleviate the Commission's concerns. In September, the Commission referred the case the European Court of Justice (ECJ).
In addition to suspending the application of the law, Friday's ECJ ruling also ordered Poland to reinstate the Supreme Court justices who had already been forced to step down.
"The order of the Vice-President of the Court is to apply, with retroactive effect, to the judges of the Supreme Court concerned by those provisions," it said.
Prime Minister Mateusz Morawiecki said the government had received the decision.
"I can say that certainly after thorough analysis we will take a position," Morawiecki told reporters while attending an EU-Asia summit in Brussels on Friday, Reuters reported.
Malgorzata Gersdorf, the 65-year-old head of Poland's Supreme Court who had refused to step down after the law was implemented, said Friday she was happy with the EU court's ruling.
"I am glad that it happened, that someone took our reasons. But I am not happy that the Polish government -- the government of my country, my homeland -- has not done it before and that we have to stand in the European Tribunal," Gersdorf told local media including the Polish Press Agency.
She previously told CNN in September that the government's judicial reforms were "dangerous" to democracy in a country already in "friction" with the rest of Europe.
The ECJ said the decision was an interim ruling and that it would deliver a final judgment on the case at a later date.
Poland faces financial penalties if it does not comply with the judgment, it said.