A deputy foreign minister in Poland’s previous right-wing government appeared before prosecutors Wednesday to hear charges connected to the alleged sale of visas and work permits to migrants for thousands of dollars, anti-corruption officials said.

The cash-for-visas scandal emerged last summer and undermined the tough-on-immigration stance of the ruling Law and Justice party, which went on to lose power in October parliamentary elections. An investigation was launched earlier last year.

The Central Anti-Corruption Bureau said in a statement Wednesday it had detained the former deputy foreign minister, who had been in charge of consular affairs and who was identified only as Piotr W. because of Polish privacy laws.

POLAND'S PRESIDENT BEGINS PROCESS TO PARDON 2 CONVICTED POLITICIANS

He was brought to the city of Lubin where prosecutors presented him with charges of having exceeded his authority in handling ministry documents, influencing the issuing of Polish visas and sharing classified information with an unauthorized person in 2022-23.

Polish flag

A Polish flag flies near the spire of the Palace of Culture and Sciences, Warsaw, Poland, Feb. 12, 2022. (Photo by STR/NurPhoto via Getty Images)

If convicted in a court trial, the defendant could be handed up to 10 years in prison.

The national prosecutor's office later said that the defendant protested his innocence and declined to testify.

He was released on bail. Eight other people have been charged in the case, the anti-corruption office said.

In August, Polish media reported allegations that Poland’s consular sections issued some 250,000 visas to migrants from Asia and Africa since 2021 in return for bribes. At the same time the deputy foreign minister was fired and the media linked him to the scandal.

CLICK HERE TO GET THE FOX NEWS APP

He has denied any wrongdoing.