A Brazilian judge has blocked the appointment of ex-President Luiz Inacio Lula da Silva as chief of staff to his successor, Dilma Rousseff, shortly after he was sworn in.
The judge's injunction said there was a risk a federal investigation could be derailed if Lula was a minister.
In Brazil, cabinet members can only be investigated by the Supreme Court, not by federal courts.
Lula is under investigation in connection with a corruption scandal.
The government has appealed against the decision.
Prosecutors filed charges against Lula last week accusing him of money laundering and fraud, which he has denied.
Lula's nomination as chief of staff has divided Brazilians.
Some said it was a move to shield him from prosecution while others welcomed his return to active politics.
Ahead of his swearing-in ceremony, groups of supporters and opponents of the government clashed outside the presidential palace.
The ceremony itself was interrupted by a protester who cried "Shame!".
The protester was drowned out by supporters of the governing Workers' Party, who shouted pro-government slogans and Lula's name.
During the ceremony, President Rousseff praised Lula, who she said was "not just a great politician, but a great friend and comrade of many battles".
"We've always stood side by side," she said.
A visibly angry Ms Rousseff then criticised federal Judge Sergio Moro, who is leading the investigation into a massive corruption scandal at state-oil giant Petrobras.
On Wednesday, Judge Moro made public a taped phone conversation between President Rousseff and Lula which has been interpreted by some to show that Lula was given the post of chief of staff to shield him from prosecution.
In the conversation, Ms Rousseff told Lula she would send him the official decree naming him as minister "just to use in case it's necessary".
President Rousseff said Judge Moro had violated the law and the constitution by releasing the tape and that she would order an investigation.
President under fire
President Rousseff herself is under considerable political pressure.
Her critics want to impeach her over allegations she manipulated Brazil's account books to hide a growing deficit.
On Thursday, members of the lower house of Congress approved the creation of a 65-member committee to look into the ongoing impeachment.
It will examine the issue over the next few weeks and make a recommendation on whether Ms Rousseff should or not be impeached.
The final decision on her political future will be taken by the Senate.
Analysts say she named Lula chief of staff so he could use his influence with members of Congress to convince them to vote against her impeachment.
As more and more members of her Workers' Party are being investigated over corruption at Petrobras, she is also facing increased questions about what she may have known.
Ms Rousseff was head of the board at Petrobras from 2003 to 2010 and has always denied any wrongdoing.
On Sunday, a record number of people took part in anti-government marches across Brazil.
An estimated three million people called for an end to corruption and for Ms Rousseff's impeachment.
There have also been rallies in support of the government, but they have been smaller than those opposing the administration.
The political upheaval comes at a time of economic problems, with Brazil going through its worst recession in more than three decades.