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.

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.