Tapped phone calls between ex-President Luiz Inacio Lula da Silva and prominent public figures suggest attempts were made to curry favor for the former leader in his judicial woes, according to the magistrate in charge of the sprawling corruption investigation at Brazil's state-run Petrobras oil company.

Judge Sergio Moro released nearly 50 audio recordings Wednesday, hours after President Dilma Rousseff appointed Silva as her chief of staff — a move that critics called an attempt to help shield him from potential detention as part of the corruption probe.

In his filing, Moro justified the release by saying democracies "demand that the people know what their officials are doing, even when they attempt to act under the cover of shadow." He also stressed there was no indication the attempts to secure favors for Silva bore fruit, but the day's rollercoaster of events seemed to stoke more anger at Silva, Rousseff and the governing Workers' Party.

Police used tear gas and stun grenades against an estimated 5,000 anti-government protesters who massed outside Congress late Wednesday. Sao Paulo and Rio de Janeiro also saw protests. In the southern city of Curitiba, where Moro is based, hundreds gathered in front of the court to show support for the magistrate and his "Car Wash" investigation into a corruption scheme at Petrobras that prosecutors say involved billions in bribes for inflated contracts.

On Sunday, an estimated 3 million people turned out for anti-government demonstrations nationwide.

Silva's appointment is being widely viewed as a way to shield him from his legal woes because under Brazilian law, only the Supreme Court can authorize the investigation, imprisonment and trial of Cabinet members and legislators. That special judicial status now applies to Silva because his appointment has appeared in a special edition of the government's official gazette. A swearing-in ceremony was set for Thursday morning in Brasilia, the capital.

In his filing, which was made public late Wednesday along with nearly 50 recordings, Moro said: "I observe that in some dialogues, there is talk apparently of attempting to influence or obtain help from officials in the public prosecutor's office or the magistrate in favor of the ex-president."

However, he added, "there is no indication inside or outside the dialogues that those mentioned in fact proceeded in an inappropriate manner."

"From the tenor of the taped conversations, it is clear that the ex-president already knew or at least suspected he was being taped," the judge added.

In a twist, recordings made Wednesday appeared to have been made after Moro ordered the tapping stopped. In a statement, police said they requested phone companies halt the taps as soon as they received Moro's order, but it may have taken time for it to be implemented. The police said it was Moro's decision on which recordings to include in the probe.

In a statement late Wednesday, the presidential palace called the release of the tapes an "affront to the rights and guarantees of the presidency." It said that "all the appropriate judicial and administrative measures will be taken to repair the flagrant violation of the law and the constitution committed by the judge behind the leak."

An attorney for Silva, Cristiano Zanin Martins, condemned the recordings, saying their release was sparking a "social convulsion ... which is not the role of the judiciary."

The filing by Moro was the latest twist in a dramatic saga that has drawn comparisons to the country's famous prime-time soap operas, known as "novelas" to Brazilians.

Silva's appointment as Rousseff's chief of state came after days of intense speculation about the move.

Speaking at a news conference after the announcement, she vehemently denied Silva accepted the post to delay investigations against him, stressing that Cabinet ministers' special judicial standing does not grant them immunity.

"It doesn't mean that he will not be investigated," Rousseff said. "It's a question of whom he will be investigated by."

Rousseff, who herself was chief of staff for Silva in 2005-2010, said she was "very happy" to have Silva in her government.

"His joining my government strengthens my government," she said.

A dexterous political operator, Silva had been seen as Rousseff's best hope for shoring up support for the administration and its agenda by sealing alliances with key centrist and right-leaning parties in Congress and securing the support of social movements.

Silva was also regarded as crucial to fending off the impeachment proceedings against Rousseff over accusations of fiscal mismanagement unrelated to the Petrobras probe.

The opposition excoriated his appointment, and analysts said it could dramatically weaken Rousseff.

Rousseff had been untouched by the Petrobras turmoil. But the Supreme Court on Tuesday accepted a plea bargain by a former Senate leader for the Workers' Party who alleged Rousseff at least knew about wrongdoing at Petrobras, which she formerly oversaw.

Both Rousseff and Silva have repeatedly denied any wrongdoing.