Protests have erupted in Brazil's capital after a recorded phone call between President Dilma Rousseff and her once-popular predecessor was released, suggesting that she appointed him to her cabinet to spare him from arrest for corruption.

Rousseff appointed Luiz Inacio Lula da Silva as her chief of staff on Wednesday hoping that his political prowess can save her administration.

The president is battling an impeachment attempt, a deep recession, and the fallout of an explosive corruption scandal at state oil giant Petrobras.

Scroll down for video

Anti-government demonstrators wave a Brazilian national flag next to a bonfire during a protest

Police in riot gear prepare to take on hundreds of demonstrators in Brasilia, central Brazil

A view from above shows the extend of the protest which is against Luiz Inacio Lula da Silva becoming the government's chief of staff

However hours after Lula's appointment, federal judge Sergio Moro, who is heading a probe into the Petrobras scandal, ordered the release of a call recorded by police suggesting darker motives.

Rousseff called Lula's bugged phone to tell him she would be sending him the official decree nominating him as her chief of staff so that he could make use of it 'if necessary.'

That extract seems to confirm that Lula's nomination to the post was aimed at sparing him possible arrest for corruption.

Cabinet ministers can only be tried before the Supreme Court in Brazil, and ministerial immunity will now protect Lula from prosecution in criminal court.

Lula vigorously denies involvement in the scandal, in which investigators say construction companies conspired with Petrobras executives to overbill the oil giant to the tune of $2 billion, paying huge bribes to politicians and parties along the way.

Rousseff's office said the phone call was merely to discuss a procedural matter.

The recording's release caused an uproar in Congress, where furious opposition lawmakers shouted 'Resign! Resign!'

President Rousseff named her predecessor Luiz Inacio Lula da Silva as her chief of staff Wednesday, sparing him possible arrest for corruption as she seeks to fend off a damaging crisis

Riot police try and defend the area from protesters who are angry over the government appointment

Demonstrators confront riot policemen as they protest against corruption in Brasilia

Pepper spray is used to try and deter protesters from the scene in Brasilia

Rousseff called Lula's bugged phone to tell him she would be sending him the official decree nominating him as her chief of staff so that he could make use of it 'if necessary'

This afternoon a federal judge suspended President Dilma Rousseff's appointment of her predecessor Luiz Inacio Lula da Silva as her new chief of staff.

'I hereby interrupt the nomination of Mr Luiz Inacio Lula da Silva to the position of chief of staff or any other that grants him immunity,' Judge Itagiba Catta Preta said in the preliminary ruling, which must still be reviewed by a higher court and can be appealed.

Some 2,000 people had been gathered in the capital Brasilia to demand that Lula step down and Rousseff leave office.

'Instead of explaining himself and assuming his responsibilities, former president Lula preferred to flee out the back door,' said lawmaker Antonio Imbassahy, lower house leader for opposition party PMDB.

'It's a confession of guilt and a slap to society. President Dilma, by appointing him, has become his accomplice,' Imbassahy added. 'The final chapter in this story will be her impeachment.'

As night fell, another protest broke out in Sao Paulo.

'Resign! Resign!' shouted several thousand protesters gathered outside the building housing FIESP, a powerful federation of Sao Paulo industries. The building was illuminated in green and yellow - Brazil's national colors - and included a large inscription that read 'Impeach now.'

Former Brazilian president Luiz Inacio Lula da Silva (left) hugs Brazilian president Dilma Rousseff during Lula's swear in ceremony as chief of staff, in Brasilia today

Cabinet ministers can only be tried before the Supreme Court in Brazil, and ministerial immunity will now protect Lula from prosecution in criminal court

Rousseff's office said the phone call was merely to discuss a procedural matter

An anti-government demonstrator (left) and a supporter of Brazil's President Dilma Rousseff clash today before the appointment of former Brazilian president Luiz Inacio Lula da Silva as chief of staff, near the Planalto palace in Brasilia, Brazil

Anti-government protestors and supporters of former President Luiz Inacio Lula da Silva and President Dilma Rousseff, clash

A police officer uses pepper spray on demonstrators during a protest over the appointment of the former Brazilian president

Demonstrators attend a protest over the appointment of former Brazilian president Luiz Inacio Lula da Silva

A man holds a framed image of former President Luiz Inacio Lula da Silva and a woman holds up a drawing in his likeness, during a demonstration in support of Silva, in Brasilia

The impeachment push is not directly related to the corruption scandal, but has advanced in tandem with it.

The president's office responded by announcing that 'judicial and administrative measures' would be taken to 'repair the flagrant violation of the law and the constitution committed' by judge Moro, but gave no specifics.

On social media, critics gleefully quoted Lula's own words as a rabble-rousing labor leader back to him: 'In Brazil, when a poor person steals, he goes to prison. When a rich person steals, he becomes a cabinet minister!'