By Anthony Boadle and Leonardo Goy
Former Brazilian president Luiz Inacio Lula da Silva has been sworn in as chief of staff to his successor Dilma Rousseff as a judge sought to block his appointment and congress began proceedings to impeach her.
Police used tear gas to disperse hundreds of opposition demonstrators who clashed with Mr Lula's leftist supporters outside the presidential palace where he was sworn in, while ministers and corruption investigators traded barbs throughout the day.
Spontaneous protests also blocked major avenues in Sao Paulo and Rio de Janeiro, spurred by anger that Mr Lula's appointment will shield the former president from prosecutors who charged him with money laundering and fraud as part of a sweeping graft probe centred on state-run oil company Petrobras.
Only Brazil's Supreme Court has jurisdiction in cases against ministers. Shortly after the swearing-in ceremony, a federal judge in Brasilia issued an injunction against Mr Lula's appointment on the grounds it blocked "the free exercise of justice".
Attorney General Jose Eduardo Cardozo vowed to appeal the injunction against Mr Lula joining the government, which he called the decision of a partisan judge.
The stand-off inflamed tensions that are already running high between Brazil's executive and judiciary branches, as the Petrobras probe reaches Ms Rousseff's inner circle and hangs over a congressional impeachment committee named on Thursday.
Calls for Ms Rousseff's impeachment have centred on allegations, unrelated to Petrobras, that she broke budget rules to boost spending as she campaigned for re-election in 2014.
A 65-member impeachment committee in the lower house of congress will now study if there are grounds to try her in the Senate.
Ms Rousseff and Lula have both denied any wrongdoing.
Ms Rousseff appointed her mentor, who remains one of Brazil's most influential politicians six years after leaving office, in an effort to fight impeachment and win back working-class supporters amid the worst economic recession in decades.
The corruption probe, however, has weakened Lula's sway in congress and there are growing signs that
Ms Rousseff's main coalition partner is ready to abandon the unpopular government.
As Ms Rousseff swore Lula into office, she strongly criticised the release on Wednesday of a taped telephone conversation between them that was made public by Sergio Moro, the crusading federal judge overseeing the Petrobras investigation.
Moro, the public face of the biggest graft probe in Brazilian history, said the tape showed they had discussed influencing prosecutors and courts to protect Lula, who leaves Moro's jurisdiction by joining the government.
Brazil's biggest-ever corruption probe, which centres on bribes and political kickbacks at Petrobras, has convicted dozens of powerful executives and politicians while recovering 2.9 billion reals ($A1 billion) in stolen money.
Prosecutors accuse Mr Lula of concealing ownership of an oceanfront apartment that was built and furnished by one of the Petrobras contractors in the graft scheme.