Outraged Brazilians protested in Brasilia and Sao Paulo following the release of a taped phone call between President Dilma Rousseff and her predecessor Luiz Inacio Lula da Silva.
During the call, recorded Wednesday by police and released by a federal judge, Rousseff called Lula on his bugged phone to tell him she would be sending him the official decree nominating him as her chief of staff so that he could make use of it "if necessary."
That extract was largely seen as confirmation that an aim of Lula's nomination to the post was to spare him possible arrest for corruption.
Cabinet ministers can only be tried before the Supreme Court in Brazil and ministerial immunity will now protect Lula from prosecution in criminal court.
The recording was made public by federal judge Sergio Moro, who is heading a probe into Brazil's biggest ever corruption scandal.
Lula vigorously denies involvement in the scandal, in which investigators say construction companies conspired with Petrobras executives to overbill the oil giant to the tune of $2 billion, paying huge bribes to politicians and parties along the way.
The release of the recording caused an uproar in Congress, where furious opposition lawmakers shouted "Resign! Resign!"
Some 2,000 people spontaneously gathered in the capital Brasilia demanding that Lula step down and Rousseff leave office and to show their support Moro.
As night fell, another protest began in Sao Paulo, according to an AFP photographer.
"Resign! Resign!" shouted several thousand protesters at the foot of a highrise housing FIESP, a powerful federation of Sao Paulo industries that was illuminated in green and yellow -- Brazil's national colors -- in addition to a large inscription that read "Impeach now."
The presidency responded by announcing in a statement that "judicial and administrative measures" would be taken to "repair the flagrant violation of the law and the constitution committed by judge" Moro, without going into specifics.
It said that Rousseff sent the decree to Lula only so that he could sign it and make it official since he had indicated he would not be in Brasilia for the official taking up of the role planned for Thursday.
Lula's appointment is a risky bet for Rousseff, who is battling crises on multiple fronts: an impeachment attempt, a deep recession, mass protests and the fallout of the Petrobras scandal.
The impeachment push against Rousseff is not directly related to the corruption scandal, but has advanced in tandem with it, deepening the crisis engulfing her administration.
On Sunday, an estimated three million Brazilians flooded the streets in nationwide protests calling for Rousseff's departure.