Brazilians have protested in several cities against President Dilma Rousseff after she named her predecessor, Luiz Inacio Lula da Silva, chief of staff.
In the capital Brasilia, riot police fired pepper spray at protesters outside the presidential palace.
Lula is currently being investigated in a major corruption scandal.
Hours after the move, the federal judge leading the probe against Lula released phone recordings suggesting Ms Rousseff appointed Lula to spare him arrest.
Brazil's leader, who is herself facing impeachment proceedings, defended the appointment.
She said Lula was a "skilful political negotiator" and experienced leader who would help kick off economic recovery.
She said the ex-president could also still be prosecuted by the Supreme Court.
The release of the telephone recordings caused an uproar in Congress in Brasilia, with chaotic scenes as opposition leaders gathered around a microphone chanting "resign, resign".
There were also demonstrations in at least three other Brazilian cities.
"Theft, corruption, that's the coup... We're not clowns. Brazil is better than all of this," Reuters news agency quoted one Brasilia protester as saying.
Lula was briefly detained and questioned earlier this month over allegations of money laundering connected to Operation Car Wash, a massive investigation into corruption at the state oil giant, Petrobras.
He denies the allegations, saying they are aimed at preventing him from running for president again in 2018.
In the taped telephone conversation released by Judge Sergio Moro, who is overseeing the Petrobas probe, Ms Rousseff offered to send Lula a copy of his appointment "in case of necessity" - interpreted by some as meaning in case he needed it to avoid arrest.
Part of the phone call released by Judge Moro
Rousseff: "Hello? Lula: "Hello."
Rousseff: "Lula let me tell you something." Lula: "Tell me, dear."
Rousseff: "The following: I am sending you Bessias [one of her judicial advisers] with a paper for us to have it and only use it if necessary, it is the investiture documents, OK?"
Lula: "Uhuh. OK, OK."
Rousseff: "That's it, wait there and he is going there."
Lula: "OK, I am here, I'll be waiting."
Rousseff: "OK?" Lula: "OK."
Rousseff: "Bye." Lula: "Bye, dear."
Ms Rousseff has said she will refer Judge Moro to the Supreme Court for political interference.
Lula and other ministers appointed by Ms Rouseff are expected to be sworn in at 10:00 (13:00 GMT) on Thursday.
Under Brazilian law, cabinet members can only be tried by the Supreme Court.
As chief of staff, Lula is expected to lead the fight against moves in Congress to impeach President Rousseff over allegations she manipulated Brazil's account books to hide a growing deficit.
The impeachment push is not directly related to the corruption scandal, but has run in tandem with it.
Analysts say President Rousseff is hoping that Lula will use his political nous and influence with members of Congress to block the proceedings.
The two politicians have been close for decades - Lula was Ms Rousseff's political mentor and she is his hand-picked successor.
During his time in office, the Brazilian economy experienced unprecedented economic growth and wealth redistribution.
Lula: 'Man of the people'
- Born 27 October 1945 into a poor, illiterate family in Pernambuco state
- Worked in Sao Paulo's car industry
- Achieved national fame leading strikes during military rule
- In 1980 he founded the Workers' Party (PT), the first major socialist party in Brazil's history
- Elected president in 2002 at the fourth attempt and went on to serve two terms
- Pumped billions of dollars into social programmes such as Bolsa Familia that benefited tens of millions of Brazilians
- When he left office in 2010 he said: "I am leaving government to live life on the streets. Man of the people that I always was, I will be more of the people than ever before"
- Currently under investigation over his deals with construction firms