Poland's deputy justice minister resigned Tuesday after allegations surfaced he encouraged an online hate campaign against judges critical of the government.

Lukasz Piebiak said in a statement he was stepping down in the interest of the government, adding that he planned to sue the onet.pl news portal, which published the allegations against him, for libel.

Earlier in the day Prime Minister Mateusz Morawiecki said he had demanded an explanation from Justice Minister Zbigniew Ziobro after the site published its story. Onet.pl reported that Piebiak encouraged an online user to try to discredit some 20 judges who had been critical of the government, including the head of the independent Iustitia association of judges.

It was another embarrassment for the right-wing government ahead of October elections, after the speaker of the parliament resigned earlier this month amid a scandal over his frequent use of a government jet with his family.

Still, the Law and Justice party is leading opinion polls, chiefly due to its policy of subsidies for families with children and to retirees.

According to the onet.pl report, Piebiak, a judge himself, furnished the online user, identified only as Emilia, with personal data and addresses of the judges, in violation of the law. Warsaw prosecutors said they have opened an investigation into the allegations.

The portal published what it described as a written exchange between the two, in which Piebiak assures Emila's immunity "for doing good things." She asks for a raise, suggesting she had been doing such work for some time and had been remunerated for it.

In the exchange, she offers to disseminate discrediting information about the judges to the state-run media and among judicial circles.

The judges targeted have criticized the right-wing government, in office since 2015, for changes it has made to Poland's judiciary, saying they put judges under political control and damaged judicial independence. The changes have led European Union leaders to open disciplinary proceedings against Poland's conservative government over its rule of law record.

Opposition parties are also calling for the resignation of Justice Minister Zbigniew Ziobro, saying that the portal's revelations also compromise him and the whole governing party.