Former leader Lula da Silva was sworn in as President Dilma Rousseff's chief of staff on Thursday amid a deepening crisis in Brazil as protests against his appointment continued for a second day and a judge sought to block the move.
Police used tear gas to disperse hundreds of opposition protesters who clashed with Lula's supporters outside the futuristic presidential palace in the capital Brasilia before his swearing-in.
Demonstrations also took place in Sao Paulo and Rio de Janeiro amid anger that Lula's appointment will shield the former president from prosecutors who have charged him with money laundering and fraud as part of a sweeping graft probe centered on state oil company Petrobras.
Only Brazil's Supreme Court has jurisdiction in cases against ministers.
Twenty minutes after the swearing-in ceremony, a federal judge in Brasilia issued an injunction to suspend Lula's appointment on the grounds it prevented the free exercise of justice. The move was likely to inflame tensions that are already running high between the executive and the judiciary.
The attorney-general's office said it would appeal in a higher court. It was not immediately clear whether Lula,70, could exercise his office.
Rousseff appointed her mentor, who remains one of Brazil's most influential politicians six years after leaving office, in an effort to shore up her support against pending impeachment proceedings.
The corruption investigation, however, has weakened Lula's sway in Congress and there are growing signs that Rousseff's main coalition partner is preparing to abandon the unpopular government, which is struggling to cope with Brazil's worst recession in a generation.
During the swearing-in ceremony, Rousseff strongly criticized the release on Wednesday of a taped telephone conversation between her and Lula that was made public by another federal judge. The judge said the tape showed they had discussed influencing prosecutors and courts to protect the ex-president.
Convulsing Brazilian society with lies, with reprehensible practices violates constitutional rights and as well as the rights of citizens, said Rousseff, who is herself facing mounting pressure to quit. She called the recording illegal and anti-democratic.
However Judge Sergio Moro, who is overseeing the graft probe, said in a court filing released on Wednesday that the taped telephone conversations did not provide proof that Lula and Rousseff carried out plans to interfere with his investigation.
He said, however, that he released the recordings because citizens had a right to know how they were being governed.
One recording, made public by the court, showed Rousseff offering to send Lula a copy of his appointment urgently in case it was necessary, a possible reference to the ministerial post providing him with immediate immunity.
Brazil's biggest ever corruption probe, which centers on the bribes and political kick backs at Petrobras, has led to the conviction of dozens of executives and politicians while recovering 2.9 billion reais ($794.46 million) in stolen money.
The prosecutor leading the investigation, Deltan Dallagnol, said in a statement from the southern city of Curitiba that judicial powers will not be intimidated, following Rousseff's criticism of the recordings.
The scandal has divided her governing coalition and moved her main partner, the PMDB party, closer to breaking with her government.
Vice President Michel Temer, leader of the PMDB, did not attend the swearing-in of Lula, his aides said, because Rousseff appointed a party lawmaker, Mauro Lopes, as civil aviation minister even though a party convention on Saturday banned its members from taking new posts in her government.