Brazil's President Dilma Rousseff has appointed her predecessor Luiz Inacio Lula da Silva as her new chief of staff.
The move shields Lula from possible prosecution by a federal judge investigating a massive corruption scandal named Operation Car Wash.
The move sparked protests in several cities by those angry at the decision.
But Ms Rousseff said that protecting Lula from prosecution was not the motivation for the appointment.
"Lula's arrival in my government strengthens it and there are people who don't want it to be stronger."
Under Brazilian law, cabinet members can only be tried by the Supreme Court.
On 4 March, Lula was briefly detained and questioned 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 and says they are aimed at preventing him from running for president again in 2018.
In a taped telephone conversation released by the judge overseeing the investigation, 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.
Lula in the spotlight
Hours after the announcement of Lula's appointment, protesters gathered outside the Presidential Palace in Brasilia and in at least three other cities.
"I'm tired. I'm not the police; I'm a Brazilian who is tired of so much corruption," one protester in Brasilia told Reuters.
In Congress, opposition politicians gathered around a microphone during a chaotic session and chanted "resignation".
Ms Rousseff says the appointment is due to Lula being a "skilful political negotiator" and experienced leader who will help kick off economic recovery.
During his time in office, the Brazilian economy experienced unprecedented economic growth and wealth redistribution.
"I believe [former] President Lula, who was in charge of the country for eight years, cannot have his reputation destroyed in this manner," added Ms Rousseff.
Fight against impeachment
Lula and other ministers appointed on Wednesday are expected to be sworn in at 10:00 local time (13:00 GMT) on Thursday.
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.
Analysts say President Rousseff is hoping that Lula will use his political nous and influence with members of Congress to block impeachment proceedings.
The two politicians have been close for decades. Lula was Ms Rousseff's political mentor and she is his hand-picked successor.
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 Brazil's 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