RIO DE JANEIRO — The federal judge who doomed former President Luiz Inácio Lula da Silva’s bid to return to power by convicting him on corruption charges last year, agreed on Thursday to take a cabinet post in the government of the country’s new president, Jair Bolsonaro.

The decision by the judge, Sérgio Moro, to take the helm of the Justice Ministry was met with both outrage and jubilation, a reflection of how polarizing he has become.

The position is newly reconfigured to oversee efforts to fight organized crime and corruption. Mr. Moro, the most visible law enforcement figure in a sweeping corruption inquiry that began in 2014, has been hailed at home and abroad as a crusading disrupter of a political class many saw as descending into kleptocracy.

Yet some Brazilians also came to regard him as a political operator doing the bidding of conservative politicians, particularly as he oversaw the swift prosecution of Mr. da Silva on corruption and money laundering charges.