Poland’s president Andrzej Duda vetoed legislation that would have demoted officials involved in the imposition of martial law in Poland 37 years ago.

The bill, which was passed by parliament this month, is part of broader efforts by the ruling Law and Justice (PiS) party to erase the legacy of communism in Poland.

As reported by the Financial Times, the legislation would have demoted officials on the communist-era military council that ran Poland from late 1981 until July 1983, including now-deceased generals such as Wojciech Jaruzelski, who headed the council, and Czeslaw Kiszczak, who was interior minister at the time.

In a statement, Duda said he considered it unfair as it did not allow those affected (some of whom are still alive) to appeal.

“We cannot restore justice in Poland while at the same time introducing unfair solutions,” he said. “I would not want a law to be enacted which… would divide our society instead of being accepted with understanding.”

But a Law and Justice spokeswoman said the party was “surprised and disappointed” by Duda’s decision. Antoni Macierewicz, a hardline former defence minister who has frequently clashed with Duda, told Radio WNET that the move was “the latest step in the very wrong direction we have been [going] in recent months”.

In a separate report, Deutsche Welle (DW), Germany’s international broadcaster, noted that the bill would strip Gen. Miroslaw Hermaszewski, of his ranking. He is Poland’s only astronaut and is seen as a national hero. He was drafted onto the council in 1981 without his knowledge or consent and discharged from it after two weeks.

DW also noted that Duda’s rejection of the bill may be seen as a bid to improve his chances for re-election in 2020 at a time when the ruling PiS, his ally, is witnessing a drastic drop in popularity.