Poland's government has reinstated a number of Supreme Court judges whom it had forced into early retirement.
President Andrzej Duda formalised the move on Monday meaning that a third of top judges will now be reinstated.
The government controversially lowered the retirement age for judges earlier this year, forcing many to quit, in what critics said was a political move by the ruling Law and Justice Party.
Critics said the law helped give Law and Justice (PiS) political control of the Supreme Court.
The PiS has already appointed the majority of judges to the Constitutional Tribunal, which has the power to veto legislation, and also controls the body that nominates all judges in Poland.
It argued that the reforms were needed to remove judges appointed during the communist era and to make the court more efficient.
Why the government U-turn?
The European Court of Justice's ruling in October was requested by the European Commission - the EU's executive arm - which argued that the reforms undermined the rule of law because they gave the governing party political control of the judiciary.
On Monday, this decision was upheld and President Duda had until midnight to decide whether to comply.
But the government had already agreed to scrap the law saying it respected the court's decision.
"We are members of the European Union and we will abide by European Union law," the head of the PiS, Jaroslaw Kaczynski, said last month.
What was the law?
The Supreme Court law, which lowered the retirement age for judges from 70 to 65, was introduced in July and triggered widespread street protests.
More than 20 judges - about a third of the total - were forced to retire but will now be able to return to work.
Opponents had feared the PiS would use the law to appoint new judges loyal to the authorities.
One such opponent was the head of the Supreme Court, who refused to stand down and argued that Poland's constitution guaranteed her the right to serve a six-year term.
Chief Justice Malgorzata Gersdor, 65, branded the reforms a "purge".
The conservative government denied the accusations, and argued that the country's judiciary had not been properly reformed after the end of communism in 1989.