He promised salvation for a country “in ruins” — an end to immigration, a civil service stripped of entrenched left-wing opponents, a judiciary purged of meddlesome judges and a news media giving voice to the people instead of elites.

Those campaign pledges — similar to ones made by Donald J. Trump during his successful bid for a second term as U.S. president — helped bring Jaroslaw Kaczynski and his nationalist Law and Justice party to power in Poland in 2015.

More than a year after an election that ended that party’s eight-year rule, its liberal successors are still struggling to undo the “new state apparatus” that Mr. Kaczynski helped put in place and that legal experts say seriously damaged Poland’s legal system.

Unwinding the legacy of populist conservative rule “takes longer than you expect,” said Adam Bodnar, the justice minister at the forefront of the new government’s efforts to reverse Poland’s retreat from liberal democracy under Law and Justice.

That retreat involved the politicization of Poland’s judiciary, a near total ban on abortion, the hijacking of public broadcasting for propaganda and a deep rift with the European Union.

Mr. Bodnar, speaking before the U.S. election, pointed to Prime Minister Viktor Orban of Hungary as an example of the tenacity of right-wing populist rule. Future successors to Mr. Orban, in power since 2010 and an ally of Mr. Trump, Mr. Bodnar said, will face formidable obstacles. “I would be very afraid,” he added.