(CNN) A Brazilian federal judge moved Thursday to block the controversial swearing-in of former President Luiz Inacio Lula da Silva as chief of staff to President Dilma Rousseff -- the latest twist in the country's deepening political crisis.

"Lula," as the two-time former president is known, was sworn into the Cabinet post amid heated protests by opponents, who say the move is an attempt to shield him from a corruption investigation.

Under Brazilian law, senior political figures can only be tried in the Supreme Federal Court, meaning any prosecution against Lula da Silva would effectively be delayed if he were chief of staff.

A demonstrator is dressed as Lula Da Silva during a protest in Rio de Janeiro on Sunday, March 13.

A demonstrator is dressed as Lula Da Silva during a protest in Rio de Janeiro on Sunday, March 13.

A police officer uses pepper spray on protesters to keep them from getting closer to the Congress building in Brasilia on March 16.

A police officer uses pepper spray on protesters to keep them from getting closer to the Congress building in Brasilia on March 16.

A woman waves a Brazilian national flag in front of a line of riot policemen in Brasilia on March 16.

A woman waves a Brazilian national flag in front of a line of riot policemen in Brasilia on March 16.

Demonstrators call for Rousseff's resignation outside the presidential palace in Brasilia on Wednesday, March 16.

Demonstrators call for Rousseff's resignation outside the presidential palace in Brasilia on Wednesday, March 16.

Demonstrators gather next to the presidential palace in Brasilia on Thursday, March 17.

Demonstrators gather next to the presidential palace in Brasilia on Thursday, March 17.

Police use water cannons on Sao Paulo protesters on March 18. Many Brazilians are also frustrated with a spiraling economy.

Police use water cannons Friday, March 18, to clear the main avenue of Sao Paulo, Brazil, where people were protesting Brazilian President Dilma Rousseff and her ministerial appointment of former President Luiz Inacio Lula da Silva. Rousseff named Lula da Silva as her chief of staff, and her critics say it is an attempt to shield him from a corruption investigation.

Police use water cannons Friday, March 18, to clear the main avenue of Sao Paulo, Brazil, where people were protesting Brazilian President Dilma Rousseff and her ministerial appointment of former President Luiz Inacio Lula da Silva. Rousseff named Lula da Silva as her chief of staff, and her critics say it is an attempt to shield him from a corruption investigation.

The swearing-in took place amid chaotic scenes in Brazil's capital, Brasilia, with protesters shouting "shame" while government supporters sang "Lula" to the tune of a soccer chant.

However, a federal judge in Brasilia, Itagiba Catta Preta Neto, swiftly issued a preliminary injunction to suspend Lula da Silva's swearing-in on the grounds his appointment prevented the "free exercise of the Judiciary Power, the operation of the Federal Police and of the Federal Prosecutor's Office."

In response, Brazil's attorney general said he would appeal the injunction, state-run news agency Agencia Brasil reported. The agency later reported that he had filed the appeal.

At a news conference, the attorney general said Lula da Silva did not misuse power by becoming chief of staff and that the federal judge is not impartial. The judge has been critical of Rousseff on social media, according to Agencia Brasil.

Amid the dramatic scenes at the swearing-in ceremony, three people were arrested when pro- and anti-government factions clashed in front of the Presidential Palace in Brasilia and had to be dispersed by military police, the news agency said.

Rousseff, Lula da Silva secretly recorded

The ceremony took place a day after mass protests calling on Rousseff to resign, following another judge's release of an explosive secretly recorded phone conversation between her and Lula da Silva on Wednesday.

JUST WATCHED Brazilians protest Lula da Silva's appointment Replay More Videos ... MUST WATCH Brazilians protest Lula da Silva's appointment 02:34

Rousseff's opponents said the call lends support to their allegation that the former president's appointment to the Cabinet post is to help give him greater legal immunity from federal prosecutors, handing him a trump card against investigators.

Rousseff denied the accusation, saying there is an innocent explanation for the conversation.

Her Workers' Party has become ensnared in a wide-ranging graft probe centered on state-run oil company Petrobras -- an operation known as "Car Wash."

Nearly two weeks ago, federal police questioned Lula da Silva -- Rousseff's predecessor as president and close political ally -- on suspicion he benefited from the scheme and raided his home.

Separately, state prosecutors in Sao Paulo charged him with money laundering and requested preventive detention.

Judge releases tapes

Public anger turned to outrage Wednesday when, in the wake of the announcement of Lula da Silva's new role, the federal judge overseeing the "Car Wash" investigation released tapes of the secretly recorded conversations, saying they showed the pair were apparently trying to influence or gain assistance from courts and prosecutors in the ex-president's favor.

JUST WATCHED Mass anti-government protests in Brazil Replay More Videos ... MUST WATCH Mass anti-government protests in Brazil 02:15

In a dispatch accompanying his release of the nearly 50 audio recordings, Judge Sergio Moro noted that it appeared that Lula da Silva "already knew, or at least suspected, that he was being recorded by the Federal Police, compromising the spontaneity and credibility of several of the dialogues."

In one key exchange, relating to Lula da Silva signing the "term of office" paperwork necessary to assume the post, Rousseff said, "We'll only use it in case of emergency."

Releasing a copy of the document under discussion in the call -- the certificate Lula da Silva was required to sign to assume the post -- Rousseff's office said the phrase simply referred to the eventuality that he would need to use the document if he did not attend the swearing-in ceremony in person.

Rousseff slammed the judge's release of the recordings, calling it illegal, anti-democratic and an affront to the rights of the presidency. Many in her party have referred to the allegations against Rousseff and Lula da Silva as politically motivated.

Chaos in buildup to Rio 2016

The developments have only fueled political tensions in the recession-hit country as it gears up to host the Olympics in Rio de Janeiro in August.

The demonstrations followed mass protests Sunday in which hundreds of thousands turned out across the country, calling for the president's resignation.

Rousseff: Lula da Silva 'my dearest colleague'

Lula da Silva, a former union leader who helped found the Workers' Party in 1980, was Brazil's president from 2003 to 2010. He left office with a 90% approval rating, delivering the reins to his chief of staff and handpicked successor, Rousseff.

Photos: Artist blindfolds statues in Brazil Photos: Artist blindfolds statues in Brazil An anonymous artist in Brazil has blindfolded statues across the city of Rio de Janeiro in an effort to silently and peacefully protest the country's growing corruption problem. Hide Caption 1 of 10 Photos: Artist blindfolds statues in Brazil Indian civil rights and freedom movement leader Mahatma Gandhi's statue in the northeast of the city was one of the statues that was blindfolded. Hide Caption 2 of 10 Photos: Artist blindfolds statues in Brazil The statue of Brazilian Navy Adm. Saldanha da Gama was one of the statues blindfolded on Saturday morning. Da Gama was killed in action during one of Brazil's earliest civil war. Hide Caption 3 of 10 Photos: Artist blindfolds statues in Brazil The artist behind the blindfolds says they act as a way to shield the eyes of those who cannot do anything to change the country. All others, he says, have the ability to do something to change the "shameful" state the country is in. Hide Caption 4 of 10 Photos: Artist blindfolds statues in Brazil The statue of Brazilian compositor and singer Tom Jobim along the famous Ipanema Beach was one of the statues blindfolded over the weekend. Jobim is the composer for "Girl from Ipanema." Hide Caption 5 of 10 Photos: Artist blindfolds statues in Brazil This is just one of several protests that have taken place in Brazil over the past couple of years. Brazilians are angry over an eroding economy and a corruption scandal that has implicated politicians, business leaders and even the country's former and current presidents. Hide Caption 6 of 10 Photos: Artist blindfolds statues in Brazil The Oracle Project happened just one day before thousands of Brazilians took to the streets in Rio de Janeiro, and many other cities across the country, demanding the Brazilian President Dilma Rousseff step down. Hide Caption 7 of 10 Photos: Artist blindfolds statues in Brazil The artist behind the project told CNN he doesn't understand how politicians can sleep at night or look at themselves in the mirror knowing that there are people suffering from hunger or without an education, while the money originally allocated for these programs gets misspent elsewhere. Hide Caption 8 of 10 Photos: Artist blindfolds statues in Brazil The artist also believes the Brazilian people deserve a government that works hard for its citizens and that corrupt politicians should be removed from office and punished. Hide Caption 9 of 10 Photos: Artist blindfolds statues in Brazil The statue of Brazilian writer Carlos Drummond de Andrade, adjacent to the famous Copacabana Beach, was blindfolded over the weekend. Hide Caption 10 of 10

At the swearing-in ceremony Thursday, Rousseff introduced Lula da Silva as her "dearest colleague" and "a great political leader" with the "incomparable capacity to look in the eyes of our people and to understand these people and want the best for these people."

A day earlier, she thanked him for agreeing to serve in her administration as the country struggled through its longest recession since the 1930s, saying he would be "a huge boost for my government."

Christopher Sabatini, an adjunct professor at Columbia University's School of International and Public Affairs, said that while Rousseff was trying to sell Lula da Silva's appointment as driven by the need to harness his expertise, "the timing of it does not smell right."

JUST WATCHED What Brazil's Lula da Silva appointment means to markets Replay More Videos ... MUST WATCH What Brazil's Lula da Silva appointment means to markets 03:50

"The risk is that doubling down on this strategy is only going to really stain this administration even more," Sabatini told CNN.

In the lower house of Congress on Thursday, lawmakers met to nominate members of the 65-strong commission that will hear the impeachment charges against her. The lower house later approved the the special committee that will review the request for impeachment, Agencia Brasil reported.

Lula da Silva has expressed a desire to run for the presidency again in 2018.