WARSAW — Backing down from a showdown with Brussels, Poland’s government reversed its purge of the country’s Supreme Court, as the president signed a law on Monday that will reinstate the judges who had been forced out of their jobs.

It was a remarkable turnaround after months of Poland’s top officials saying they would resist pressure to stop the overhaul of the judiciary. The ruling party, Law and Justice, had put tightening its grip on the courts at the center of its agenda, claiming that it was vital to rid the courts of corrupt judges and Communist-era vestiges.

The European Union sees the changes Poland has made to its judiciary in the last three years as a violation of the bloc’s core values, a threat to the rule of law and the end of judges acting as a check on political power. Last year, the union chastised Poland and took the first steps toward stripping the country of its voting rights in Brussels — a penalty that has never been used against a member nation.

Poland’s concession on the Supreme Court is by no means the end of that conflict between the right-wing, nationalist Polish government and Brussels, but it represented a striking change in tone.